diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt index 56ca00b42c76f4f02aa6e77f7a233d71f1e0e068..ef316bd4b0da82b0f6c8f9b1b843b1e020bc0b72 100644 --- a/cmake/modules/CMakeLists.txt +++ b/cmake/modules/CMakeLists.txt @@ -1,3 +1,4 @@ -set(modules "DuneMultimeshMacros.cmake") - -install(FILES ${modules} DESTINATION ${DUNE_INSTALL_MODULEDIR}) +install(FILES + DuneMultimeshMacros.cmake + CXXFeatures.cmake + DESTINATION ${DUNE_INSTALL_MODULEDIR}) diff --git a/cmake/modules/CXXFeatures.cmake b/cmake/modules/CXXFeatures.cmake new file mode 100644 index 0000000000000000000000000000000000000000..7da53c653b4d731e10c4ea85545899498116d68b --- /dev/null +++ b/cmake/modules/CXXFeatures.cmake @@ -0,0 +1,13 @@ +include(CheckCXXSourceCompiles) + +# support for C++17's variant implementation +check_cxx_source_compiles(" + #include + int main() + { + std::variant a; + a = 1; + a = 2.0; + bool positive = std::visit([](auto&& x) { return x > 0; }, a); + } +" DUNE_HAVE_CXX_VARIANT ) diff --git a/cmake/modules/DuneMultimeshMacros.cmake b/cmake/modules/DuneMultimeshMacros.cmake index 613dfb664b75999b008f0003a4d7c409cbf409ad..6317ccbab347c8427a01b835c9292f0cc2118774 100644 --- a/cmake/modules/DuneMultimeshMacros.cmake +++ b/cmake/modules/DuneMultimeshMacros.cmake @@ -1 +1,3 @@ # File for module specific CMake tests. + +include(CXXFeatures) diff --git a/config.h.cmake b/config.h.cmake index e8b25064fa2e7c700ed8baa2e492106edf526778..8d2eb6183d0fb13bc5a6e3218772254f84ae3bc9 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -40,6 +40,9 @@ /* Define to the revision of dune-multimesh */ #define DUNE_MULTIMESH_VERSION_REVISION @DUNE_MULTIMESH_VERSION_REVISION@ +/* some detected compiler features may be used in this module */ +#cmakedefine DUNE_HAVE_CXX_VARIANT 1 + /* end dune-multimesh Everything below here will be overwritten */ diff --git a/dune/multimesh/mmentity.hh b/dune/multimesh/mmentity.hh index eefad1554c8d84f23ef36a21bdc583d76917e453..d0595811ce7dd9bf20409c99cdf8811a22435994 100644 --- a/dune/multimesh/mmentity.hh +++ b/dune/multimesh/mmentity.hh @@ -12,23 +12,23 @@ namespace Dune { - template + template class MultiEntity - : public std::vector::Entity> + : public std::vector::Entity> { private: - using ctype = typename GridImp::ctype; + using ctype = typename HostGrid::ctype; public: - enum { dimension = GridImp::dimension }; + enum { dimension = HostGrid::dimension }; /// The type of a local geometry - using LocalGeometry = Dune::Geometry; + using LocalGeometry = MultiMeshLocalGeometry; - using EntitySeed = typename GridImp::Traits::template Codim<0>::EntitySeed; + using EntitySeed = MultiMeshEntitySeed<0, HostGrid>; /// Entity in the host grid - using HostGridEntity = typename GridImp::HostGridType::Traits::template Codim<0>::Entity; + using HostGridEntity = typename HostGrid::Traits::template Codim<0>::Entity; /// Containertype using Super = std::vector; @@ -39,15 +39,13 @@ namespace Dune /// Return a local geometry of source in target static LocalGeometry localGeometry (HostGridEntity const& source, HostGridEntity const& target) { - using LocalGeometryImp = MultiMeshLocalGeometry; - return LocalGeometry{LocalGeometryImp{source, target}}; + return {source, target}; } /// Return a local geometry of source_i'th entity in target_t'th entity LocalGeometry localGeometry (std::size_t source_i, std::size_t target_i) const { - using LocalGeometryImp = MultiMeshLocalGeometry; - return LocalGeometry{LocalGeometryImp{(*this)[source_i], (*this)[target_i]}}; + return {(*this)[source_i], (*this)[target_i]}; } /// \brief Return the entity seed which contains sufficient information @@ -58,8 +56,7 @@ namespace Dune **/ EntitySeed seed (std::size_t entity_i) const { - using EntitySeedImp = MultiMeshEntitySeed<0, const GridImp>; - return EntitySeedImp{(*this)[entity_i], entity_i}; + return {(*this)[entity_i], entity_i}; } /// Return the entity with maximal level diff --git a/dune/multimesh/mmgeometry.hh b/dune/multimesh/mmgeometry.hh index 44f30ddc6965e720e50c3dd29135590c3e8ba2eb..b660613925a3e5bfd8ecb802aacaceff92a470e8 100644 --- a/dune/multimesh/mmgeometry.hh +++ b/dune/multimesh/mmgeometry.hh @@ -9,23 +9,23 @@ namespace Dune { - template + template class MultiMeshLocalGeometry - : public GeometryDefaultImplementation + : public GeometryDefaultImplementation { private: - using ctype = typename GridImp::ctype; + using ctype = typename HostGrid::ctype; public: // The codimension of this entitypointer wrt the host grid - enum { codimension = GridImp::HostGridType::dimension - mydim }; - enum { dimensionworld = GridImp::HostGridType::dimensionworld }; + enum { codimension = HostGrid::dimension - mydim }; + enum { dimensionworld = HostGrid::dimensionworld }; // select appropriate hostgrid geometry via typeswitch - using HostLocalGeometry = typename GridImp::HostGridType::Traits::template Codim::LocalGeometry; + using HostLocalGeometry = typename HostGrid::Traits::template Codim::LocalGeometry; /// entity in the host grid - using HostGridEntity = typename GridImp::HostGridType::Traits::template Codim::Entity; + using HostGridEntity = typename HostGrid::Traits::template Codim::Entity; //! type of jacobian transposed using JacobianInverseTransposed = typename HostLocalGeometry::JacobianInverseTransposed; diff --git a/dune/multimesh/mmiterator.hh b/dune/multimesh/mmiterator.hh index eedfcd78cf0a230a688e1951fa4df56d43c090a2..005ea88b7d71314e2fc3704f1d3efdedbf267d17 100644 --- a/dune/multimesh/mmiterator.hh +++ b/dune/multimesh/mmiterator.hh @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -23,7 +24,7 @@ namespace Dune /** \brief Iterator over all entities of a given codimension and level of a grid. * \ingroup MultiMesh */ - template + template class MultiMeshIterator { public: @@ -41,18 +42,18 @@ namespace Dune // Implemented for codim 0 entities only - template - class MultiMeshIterator<0, pitype, GridImp> - : public ForwardIteratorFacade, - MultiEntity, - MultiEntity const&> + template + class MultiMeshIterator<0, pitype, HostGrid> + : public ForwardIteratorFacade, + MultiEntity, + MultiEntity const&> { private: // LevelIterator to the equivalent entity in the host grid using HostGridLevelIterator = - typename GridImp::HostGridType::template Codim<0>::template Partition::LevelIterator; + typename HostGrid::template Codim<0>::template Partition::LevelIterator; - using HostEntity = typename GridImp::HostGridType::template Codim<0>::Entity; + using HostEntity = typename HostGrid::template Codim<0>::Entity; using EntityTest = std::function; @@ -96,6 +97,7 @@ namespace Dune public: /// Constructor. Stores a pointer to the grid + template MultiMeshIterator (const GridImp* multiMesh, int level) : incrementAllowed_(multiMesh->size(), true) , contains_(multiMesh->size(), EntityTest{[level](const HostEntity& entity) { return entity.level() == level; }}) @@ -121,6 +123,7 @@ namespace Dune * \param multiMesh Pointer to grid instance * \param endDummy Here only to distinguish it from the other constructor */ + template MultiMeshIterator (const GridImp* multiMesh, int level, bool endDummy) { for (auto const& grid : multiMesh->grids_) @@ -128,11 +131,13 @@ namespace Dune } /// Constructor which create the leaf-iterator + template MultiMeshIterator (const GridImp* multiMesh) : MultiMeshIterator{multiMesh, -1} {} /// Constructor which create the end leaf-iterator + template MultiMeshIterator (const GridImp* multiMesh, bool endDummy) : MultiMeshIterator{multiMesh, -1, endDummy} {} @@ -161,6 +166,41 @@ namespace Dune : macroIterators_{gridViews.grid().levelGridView(0).template end<0,pitype>()...} {} +#if DUNE_HAVE_CXX_VARIANT + template + MultiMeshIterator (const std::vector>& gridViews) + : incrementAllowed_(gridViews.size(), true) + , multiEntity_(gridViews.size()) + { + contains_.reserve(gridViews.size()); + entityStacks_.reserve(gridViews.size()); + maxLevel_.reserve(gridViews.size()); + + for (auto const& gvs : gridViews) { + macroIterators_.push_back(std::visit([](auto const& gv) { + return gv.grid().levelGridView(0).template begin<0,pitype>(); }, gvs)); + macroEndIterators_.push_back(std::visit([](auto const& gv) { + return gv.grid().levelGridView(0).template end<0,pitype>(); }, gvs)); + contains_.emplace_back(std::visit([](auto const& gv) { + return EntityTest{[gv](const HostEntity& entity) { return gv.contains(entity); }}; }, gvs)); + maxLevel_.push_back(std::visit([](auto const& gv) { return gv.grid().maxLevel(); }, gvs)); + entityStacks_.emplace_back(std::visit([](auto const& gv) { return gv.grid().maxLevel(); }, gvs)); + } + + // go to first leaf entity on all grids + for (std::size_t i = 0; i < entityStacks_.size(); ++i) + initialIncrement(i); + } + + template + MultiMeshIterator (const std::vector>& gridViews, bool endDummy) + { + for (auto const& gvs : gridViews) { + macroIterators_.push_back(std::visit([](auto const& gv) { + return gv.grid().levelGridView(0).template end<0,pitype>(); }, gvs)); + } + } +#endif /// prefix increment void increment () @@ -175,7 +215,7 @@ namespace Dune } /// dereferencing - MultiEntity const& dereference () const + MultiEntity const& dereference () const { // update entries in multiEntity that have changed for (std::size_t i = 0; i < entityStacks_.size(); ++i) { @@ -275,7 +315,7 @@ namespace Dune std::vector contains_; std::vector maxLevel_; - mutable MultiEntity multiEntity_; + mutable MultiEntity multiEntity_; std::vector macroIterators_; std::vector macroEndIterators_; diff --git a/dune/multimesh/multigridview.hh b/dune/multimesh/multigridview.hh new file mode 100644 index 0000000000000000000000000000000000000000..6f08151ff06ed348988b19c791d9e539fbc6265d --- /dev/null +++ b/dune/multimesh/multigridview.hh @@ -0,0 +1,241 @@ +// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// vi: set et ts=4 sw=2 sts=2: +#ifndef DUNE_MULTI_GRIDVIEW_HH +#define DUNE_MULTI_GRIDVIEW_HH + +#if ! DUNE_HAVE_CXX_VARIANT +#error "Require C++17 variant!" +#endif + +#include + +#include +#include +#include + +#include +#include + +#include "mmiterator.hh" + +namespace Dune +{ + template + class MultiIndexSet + { + public: + using LeafIndexSet = typename HostGrid::Traits::LeafIndexSet; + using LevelIndexSet = typename HostGrid::Traits::LevelIndexSet; + + using IndexType = std::common_type_t; + + using IndexSetTypes = std::variant; + + template + MultiIndexSet(IndexSet const* indexSet) + : indexSets_(indexSet) + {} + + MultiIndexSet(IndexSetTypes const& indexSet) + : indexSets_(indexSet) + {} + + template + IndexType index (const Entity& e) const + { + return std::visit([&e](auto const* is) -> IndexType { return is->index(e); }, indexSets_); + } + + template + IndexType subIndex (const Entity& e, int i, unsigned int codim) const + { + return std::visit([&e,i,codim](auto const* is) -> IndexType { return is->subIndex(e,i,codim); }, indexSets_); + } + + private: + IndexSetTypes indexSets_; + }; + + + // forward declaration + template + class MultiGridView; + + template + struct MultiGridViewTraits + { + using Grid = typename std::remove_const::type; + + using IndexSet = MultiIndexSet; + + using Intersection = std::variant< + typename HostGrid::Traits::LeafIntersection, typename HostGrid::Traits::LevelIntersection>; + + using IntersectionIterator = std::variant< + typename HostGrid::Traits::LeafIntersectionIterator, typename HostGrid::Traits::LevelIntersectionIterator>; + + using CollectiveCommunication = typename HostGrid::Traits::CollectiveCommunication; + + template + struct Codim + { + using Entity = typename Grid::Traits::template Codim::Entity; + using Geometry = typename Grid::template Codim::Geometry; + using LocalGeometry = typename Grid::template Codim::LocalGeometry; + + template + struct Partition + { + using Iterator = MultiMeshIterator; + }; + }; + + enum { conforming = Capabilities::isLevelwiseConforming::v }; + }; + + + template + class MultiGridView + { + public: + using Traits = MultiGridViewTraits; + + /// The MultiMesh GridType + using Grid = typename Traits::Grid; + + using GridViewTypes = std::variant; + using IndexSet = typename Traits::IndexSet; + using IndexSetTypes = std::variant; + using IntersectionIterator = typename Traits::IntersectionIterator; + + using CollectiveCommunication = typename Traits::CollectiveCommunication; + + template + using IsGridView = Std::disjunction< + std::is_same,typename HostGrid::LeafGridView>, + std::is_same,typename HostGrid::LevelGridView> >; + + template + struct Codim : public Traits::template Codim {}; + + enum { dimension = HostGrid::dimension }; + enum { dimensionworld = HostGrid::dimensionworld }; + enum { conforming = Traits::conforming }; + + public: + /// Constructor. + template ...>::value, int> = 0> + MultiGridView (GridViews&&... gridViews) + : gridViews_{std::forward(gridViews)...} + {} + + template ::value, int> = 0> + MultiGridView (const std::vector& gridViews) + : gridViews_(gridViews.begin(), gridViews.end()) + {} + + template ::value_type>::value, int> = 0> + MultiGridView (Iter first, Iter last) + : gridViews_(first, last) + {} + + template ::value_type>::value, int> = 0> + MultiGridView (const IteratorRange& gridViews) + : gridViews_(gridViews.begin(), gridViews.end()) + {} + + /// Obtain a const reference to the underlying hierarchic grid + const HostGrid& grid (std::size_t idx) const + { + return std::visit([](auto const& gv) { return gv.grid(); }, gridViews_[idx]); + } + + /// Obtain the level-indexSet + // NOTE: IndexSet is one of {LeafIndexSet, LevelIndexSet} + // NOTE: do not return a reference, but a reference wrapper + IndexSet indexSet (std::size_t idx) const + { + return std::visit([](auto const& gv) -> IndexSetTypes { return &gv.indexSet(); }, gridViews_[idx]); + } + + /// Obtain number of entities in a given codimension + int size (std::size_t idx, int codim) const + { + return std::visit([codim](auto const& gv) { return gv.size(codim); }, gridViews_[idx]); + } + + /// Obtain number of entities with a given geometry type + int size (std::size_t idx, const GeometryType& type) const + { + return std::visit([&type](auto const& gv) { return gv.size(type); }, gridViews_[idx]); + } + + /// Obtain begin iterator for this view + template + typename Codim::template Partition::Iterator begin () const + { + static_assert(cd == 0, "Implemented for codim == 0 only"); + return MultiMeshIterator(gridViews_); + } + + /// Obtain end iterator for this view + template + typename Codim::template Partition::Iterator end () const + { + static_assert(cd == 0, "Implemented for codim == 0 only"); + return MultiMeshIterator(gridViews_, true); + } + + /// Obtain begin intersection iterator with respect to this view + // NOTE: IntersectionIterator is one of {LeafIntersectionIterator, LevelIntersectionIterator} + IntersectionIterator ibegin (std::size_t idx, const typename Codim<0>::Entity& entity) const + { + return std::visit([&entity](auto const& gv) { return gv.ibegin(entity); }, gridViews_[idx]); + } + + /// Obtain end intersection iterator with respect to this view + // NOTE: IntersectionIterator is one of {LeafIntersectionIterator, LevelIntersectionIterator} + IntersectionIterator iend (std::size_t idx, const typename Codim<0>::Entity& entity) const + { + return std::visit([&entity](auto const& gv) { return gv.iend(entity); }, gridViews_[idx]); + } + + /// Obtain collective communication object + const CollectiveCommunication& comm (std::size_t idx) const + { + return std::visit([](auto const& gv) -> const auto& { return gv.comm(); }, gridViews_[idx]); + } + + /// Return size of the overlap region for a given codim on the grid view. + int overlapSize (std::size_t idx, int codim) const + { + return std::visit([codim](auto const& gv) { return gv.overlapSize(codim); }, gridViews_[idx]); + } + + /// Return size of the ghost region for a given codim on the grid view. + int ghostSize (std::size_t idx, int codim) const + { + return std::visit([codim](auto const& gv) { return gv.ghostSize(codim); }, gridViews_[idx]); + } + + /// Communicate data on this view + template + void communicate (std::size_t idx, + CommDataHandleIF& data, + InterfaceType iftype, + CommunicationDirection dir) const + { + std::visit([&data,iftype,dir](auto const& gv) { gv.communicate(data,iftype,dir); }, gridViews_[idx]); + } + + private: + std::vector gridViews_; + }; + +} // end namespace Dune + +#endif // DUNE_MULTI_GRIDVIEW_HH diff --git a/dune/multimesh/multimesh.hh b/dune/multimesh/multimesh.hh index 3df5c7b7ba6e701e206c77c149f73ab55106f227..c7d77bd16b01c316e6c4477697db832b891aaa47 100644 --- a/dune/multimesh/multimesh.hh +++ b/dune/multimesh/multimesh.hh @@ -46,11 +46,11 @@ namespace Dune { /// The type of the iterator over the level entities of this codim on this partition. // using LevelIterator = Dune::EntityIterator >; - using LevelIterator = MultiMeshIterator; + using LevelIterator = MultiMeshIterator; /// The type of the iterator over the leaf entities of this codim on this partition. // using LeafIterator = Dune::EntityIterator >; - using LeafIterator = MultiMeshIterator; + using LeafIterator = MultiMeshIterator; }; /// The type of the iterator over all leaf entities of this codim. @@ -164,28 +164,28 @@ namespace Dune template typename Traits::template Codim::template Partition::LevelIterator lbegin (int level) const { - return MultiMeshIterator >(this, level); + return MultiMeshIterator(this, level); } /// one past the end on this level template typename Traits::template Codim::template Partition::LevelIterator lend (int level) const { - return MultiMeshIterator >(this, level, true); + return MultiMeshIterator(this, level, true); } /// Iterator to first leaf entity of given codim template typename Traits::template Codim::template Partition::LeafIterator leafbegin () const { - return MultiMeshIterator >(this); + return MultiMeshIterator(this); } /// one past the end of the sequence of leaf entities template typename Traits::template Codim::template Partition::LeafIterator leafend () const { - return MultiMeshIterator >(this, true); + return MultiMeshIterator(this, true); } diff --git a/dune/multimesh/utility/structuredgridbuilder.hh b/dune/multimesh/utility/structuredgridbuilder.hh index 1dd1452245c837646fa2647b2bfb8fa74794e119..4d90433ffea0f723e7b6ba2b107d4292b77c593c 100644 --- a/dune/multimesh/utility/structuredgridbuilder.hh +++ b/dune/multimesh/utility/structuredgridbuilder.hh @@ -116,7 +116,7 @@ namespace Dune * \param upperRight Upper right corner of the grid * \param elements Number of elements in each coordinate direction **/ - static std::unique_ptr createSimplexGrid ( + static void createSimplexGrid ( GridFactory& factory, const FieldVector& lowerLeft, const FieldVector& upperRight, @@ -166,9 +166,6 @@ namespace Dune permutation.end())); } } - - // Create the grid and hand it to the calling method - return std::unique_ptr(factory.createGrid()); } static std::unique_ptr createSimplexGrid ( @@ -177,7 +174,8 @@ namespace Dune const std::array& elements) { GridFactory factory; - return createCubeGrid(factory, lowerLeft, upperRight, elements); + createSimplexGrid(factory, lowerLeft, upperRight, elements); + return std::unique_ptr(factory.createGrid()); } private: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fc625bc6d979741093c2c8598b75828ec4673f45..0f6551966787d5901c46f853bbb24f9aaf6732bb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,3 +9,6 @@ target_link_dune_default_libraries("localrefinement") add_executable("uggrid" uggrid.cc) target_link_dune_default_libraries("uggrid") + +add_executable("multigridview" multigridview.cc) +target_link_dune_default_libraries("multigridview") diff --git a/src/localrefinement.cc b/src/localrefinement.cc index a44486ed5f06023ec7227023d96069d1ef3e1ace..4a6fb9c1fdb11bb0ffd7ebb0bc28a15410ce5088 100644 --- a/src/localrefinement.cc +++ b/src/localrefinement.cc @@ -69,8 +69,8 @@ int main(int argc, char** argv) using Factory = StructuredGridBuilder >; GridFactory > gridFactory(3); - - auto gridPtr = Factory::createSimplexGrid(gridFactory, lower_left, bbox, num_elements); + Factory::createSimplexGrid(gridFactory, lower_left, bbox, num_elements); + auto gridPtr = gridFactory.createGrid(); auto& grid = *gridPtr; std::cout << "number of grids = " << grid.size() << "\n"; diff --git a/src/multigridview.cc b/src/multigridview.cc new file mode 100644 index 0000000000000000000000000000000000000000..50191928ec8c3dd319ccc35dc217851ad0cfec6e --- /dev/null +++ b/src/multigridview.cc @@ -0,0 +1,75 @@ +// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// vi: set et ts=4 sw=2 sts=2: +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include // An initializer of MPI +#include // We use exceptions +#include + +#if HAVE_DUNE_ALUGRID +#include +#endif + +#include +#include + + +using namespace Dune; + +template +void printGrid(GridView const& gv) +{ + volatile std::size_t n = 0; + Dune::Timer t; + for (auto const& entity : elements(gv)) + n += gv.indexSet().index(entity); + std::cout << n << "\n"; + std::cout << "time: " << t.elapsed() << "\n"; +} + +template +void printGrid2(GridView const& gv) +{ + volatile std::size_t n = 0; + Dune::Timer t; + for (auto const& entities : elements(gv)) { + n += gv.indexSet(0).index(entities[0]); + std::cout << "indices = ["; + for (std::size_t i = 0; i < entities.size(); ++i) { + std::cout << (i > 0 ? ", " : "") << gv.indexSet(i).index(entities[i]); + } + std::cout << "]\n"; + } + std::cout << "n = " << n << "\n"; + std::cout << "time: " << t.elapsed() << "\n"; +} + +int main(int argc, char** argv) +{ + MPIHelper::instance(argc, argv); + +#if HAVE_DUNE_ALUGRID + FieldVector lower_left = {-1.5, -1.5}; + FieldVector bbox = {1.5, 1.5}; + std::array num_elements = {2, 2}; + using Grid = Dune::ALUGrid<2, 2, Dune::simplex, Dune::conforming>; + + using Factory = StructuredGridBuilder; + auto gridPtr = Factory::createSimplexGrid(lower_left, bbox, num_elements); + auto& grid = *gridPtr; + + grid.globalRefine(4); + + printGrid(grid.leafGridView()); + printGrid(grid.levelGridView(2)); + + using GridView = MultiGridView; + GridView gridView(grid.leafGridView(), grid.levelGridView(2)); + + printGrid2(gridView); + +#endif +} diff --git a/src/testiterator.cc b/src/testiterator.cc index 1373147562253bab388bedf3a1838ebe282324c2..b28964a1852b10522c7bed5bbd5a9c6d498c5943 100644 --- a/src/testiterator.cc +++ b/src/testiterator.cc @@ -70,8 +70,8 @@ int main(int argc, char** argv) using Factory = StructuredGridBuilder >; GridFactory > gridFactory(3); - - auto gridPtr = Factory::createSimplexGrid(gridFactory, lower_left, bbox, num_elements); + Factory::createSimplexGrid(gridFactory, lower_left, bbox, num_elements); + auto gridPtr = gridFactory.createGrid(); auto& grid = *gridPtr; #elif GRID == 3 && HAVE_ALBERTA diff --git a/src/uggrid.cc b/src/uggrid.cc index 53b5ce8610f8df7d19c16db4e0175a90233f3b17..e3de7a8a9c6c83cf600feaa382d0b12b2735784f 100644 --- a/src/uggrid.cc +++ b/src/uggrid.cc @@ -30,6 +30,7 @@ int main(int argc, char** argv) using Factory = StructuredGridBuilder >; GridFactory > factory(1); - auto gridPtr = Factory::createSimplexGrid(factory, lower_left, bbox, num_elements); + Factory::createSimplexGrid(factory, lower_left, bbox, num_elements); + auto gridPtr = factory.createGrid(); #endif }