Skip to content
Snippets Groups Projects
Commit b9b4672b authored by Samuel Burbulla's avatar Samuel Burbulla Committed by Timo Koch
Browse files

Some fixes for coupling moving meshes.

parent 4180083e
No related branches found
No related tags found
1 merge request!1545Some fixes for coupling moving meshes.
...@@ -181,7 +181,9 @@ public: ...@@ -181,7 +181,9 @@ public:
ParentType::updateSolution(curSol); ParentType::updateSolution(curSol);
// determine all bulk elements/scvfs that couple to low dim elements // determine all bulk elements/scvfs that couple to low dim elements
bulkElemIsCoupled_.clear();
bulkElemIsCoupled_.resize(bulkProblem->fvGridGeometry().gridView().size(0), false); bulkElemIsCoupled_.resize(bulkProblem->fvGridGeometry().gridView().size(0), false);
bulkScvfIsCoupled_.clear();
bulkScvfIsCoupled_.resize(bulkProblem->fvGridGeometry().numScvf(), false); bulkScvfIsCoupled_.resize(bulkProblem->fvGridGeometry().numScvf(), false);
const auto& bulkMap = couplingMapperPtr_->couplingMap(bulkGridId, lowDimGridId); const auto& bulkMap = couplingMapperPtr_->couplingMap(bulkGridId, lowDimGridId);
......
...@@ -197,7 +197,7 @@ protected: ...@@ -197,7 +197,7 @@ protected:
continue; continue;
// turn (insertion) indices into actual grid element indices ... // turn (insertion) indices into actual grid element indices ...
std::for_each(adjoinedEntities.begin(), adjoinedEntities.end(), [&] (auto& idx) { idx = bulkInsertionToElemIdxMap[idx]; }); std::for_each(adjoinedEntities.begin(), adjoinedEntities.end(), [&] (auto& idx) { idx = bulkInsertionToElemIdxMap.at(idx); });
// ... and add them // ... and add them
addCouplingEntryPolicy(std::move(adjoinedEntities), element, lowDimFvGridGeometry, bulkFvGridGeometry); addCouplingEntryPolicy(std::move(adjoinedEntities), element, lowDimFvGridGeometry, bulkFvGridGeometry);
...@@ -233,14 +233,14 @@ private: ...@@ -233,14 +233,14 @@ private:
//! Creates the map from element insertion index to grid element index //! Creates the map from element insertion index to grid element index
template< class Embeddings, class FVGridGeometry> template< class Embeddings, class FVGridGeometry>
std::vector< typename IndexTraits<typename FVGridGeometry::GridView>::GridIndex > std::map< typename IndexTraits<typename FVGridGeometry::GridView>::GridIndex, typename IndexTraits<typename FVGridGeometry::GridView>::GridIndex >
makeInsertionToGridIndexMap_(std::shared_ptr<const Embeddings> embeddings, const FVGridGeometry& fvGridGeometry) const makeInsertionToGridIndexMap_(std::shared_ptr<const Embeddings> embeddings, const FVGridGeometry& fvGridGeometry) const
{ {
using GridIndexType = typename IndexTraits<typename FVGridGeometry::GridView>::GridIndex; using GridIndexType = typename IndexTraits<typename FVGridGeometry::GridView>::GridIndex;
std::vector< GridIndexType > map(fvGridGeometry.gridView().size(0)); std::map< GridIndexType, GridIndexType > map;
for (const auto& e : elements(fvGridGeometry.gridView())) for (const auto& e : elements(fvGridGeometry.gridView()))
map[ embeddings->template insertionIndex<bulkId>(e) ] = fvGridGeometry.elementMapper().index(e); map.insert( std::make_pair( embeddings->template insertionIndex<bulkId>(e), fvGridGeometry.elementMapper().index(e) ) );
return map; return map;
} }
......
...@@ -251,7 +251,6 @@ public: ...@@ -251,7 +251,6 @@ public:
if (id > bulkGridId) if (id > bulkGridId)
lowDimGridVertexIndices_[id-1] = std::move(lowDimGridVertexIndices); lowDimGridVertexIndices_[id-1] = std::move(lowDimGridVertexIndices);
} }
private:
//! data on connectivity between the grids //! data on connectivity between the grids
std::array<EmbedmentMap, numGrids> embeddedEntityMaps_; std::array<EmbedmentMap, numGrids> embeddedEntityMaps_;
std::array<EmbedmentMap, numGrids> adjoinedEntityMaps_; std::array<EmbedmentMap, numGrids> adjoinedEntityMaps_;
...@@ -259,6 +258,7 @@ private: ...@@ -259,6 +258,7 @@ private:
//! Contains the hierarchy insertion indices that make up a lower-dimensional grid //! Contains the hierarchy insertion indices that make up a lower-dimensional grid
std::array<std::vector<GridIndexType>, numGrids-1> lowDimGridVertexIndices_; std::array<std::vector<GridIndexType>, numGrids-1> lowDimGridVertexIndices_;
private:
//! tuple to store the grids //! tuple to store the grids
using Indices = std::make_index_sequence<numGrids>; using Indices = std::make_index_sequence<numGrids>;
template<std::size_t id> using GridViewPtr = std::shared_ptr<GridView<id>>; template<std::size_t id> using GridViewPtr = std::shared_ptr<GridView<id>>;
...@@ -310,6 +310,11 @@ public: ...@@ -310,6 +310,11 @@ public:
const Grid<id>& grid() const const Grid<id>& grid() const
{ return *std::get<id>(gridPtrTuple_); } { return *std::get<id>(gridPtrTuple_); }
//! returns the i-th grid
template<std::size_t id>
Grid<id>& grid()
{ return *std::get<id>(gridPtrTuple_); }
//! return a pointer to the grid data object //! return a pointer to the grid data object
std::shared_ptr<const GridData> getGridData() const std::shared_ptr<const GridData> getGridData() const
{ {
...@@ -436,12 +441,14 @@ private: ...@@ -436,12 +441,14 @@ private:
//! tuple to store the grids //! tuple to store the grids
using Indices = std::make_index_sequence<numGrids>; using Indices = std::make_index_sequence<numGrids>;
using GridPtrTuple = typename makeFromIndexedType<std::tuple, GridPtr, Indices>::type; using GridPtrTuple = typename makeFromIndexedType<std::tuple, GridPtr, Indices>::type;
protected:
GridPtrTuple gridPtrTuple_; GridPtrTuple gridPtrTuple_;
private:
//! grid data, i.e. parameters and markers //! grid data, i.e. parameters and markers
bool enableEntityMarkers_; bool enableEntityMarkers_;
std::shared_ptr<GridData> gridDataPtr_; std::shared_ptr<GridData> gridDataPtr_;
protected:
//! data on embeddings //! data on embeddings
std::shared_ptr<Embeddings> embeddingsPtr_; std::shared_ptr<Embeddings> embeddingsPtr_;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment