diff --git a/dune/gfe/coupling/rodcontinuumcomplex.hh b/dune/gfe/coupling/rodcontinuumcomplex.hh index 050e4ca5c84f6a63fdd3c204195996821fbc39e6..8cd11cd78604d4336d7159d267ae5e51f40acd8f 100644 --- a/dune/gfe/coupling/rodcontinuumcomplex.hh +++ b/dune/gfe/coupling/rodcontinuumcomplex.hh @@ -51,6 +51,9 @@ class RodContinuumComplex public: + /** \brief Iterator over the couplings */ + typedef typename std::map<std::pair<std::string,std::string>, Coupling>::const_iterator ConstCouplingIterator; + /** \brief Simple const access to rod grids */ const Dune::shared_ptr<RodGrid> rodGrid(const std::string& name) const { diff --git a/dune/gfe/coupling/rodcontinuumsteklovpoincarestep.hh b/dune/gfe/coupling/rodcontinuumsteklovpoincarestep.hh index 60acbc1ca4ee2355e9b5b9a1d17e4be2cdfdb7bc..fd7019d6fd58635de323063e7b67f20b130bb4d5 100644 --- a/dune/gfe/coupling/rodcontinuumsteklovpoincarestep.hh +++ b/dune/gfe/coupling/rodcontinuumsteklovpoincarestep.hh @@ -322,6 +322,8 @@ private: RigidBodyMotion<3>::TangentVector continuumDirichletToNeumannMap(const RigidBodyMotion<3>& lambda) const; + std::set<std::string> rodsPerContinuum(const std::string& name) const; + ////////////////////////////////////////////////////////////////// // Data members related to the coupled problem ////////////////////////////////////////////////////////////////// @@ -426,20 +428,43 @@ mergeContinuumDirichletAndCouplingBoundaries() for (int i=0; i<dirichletAndCouplingNodes.size(); i++) dirichletAndCouplingNodes[i] = dirichletBoundary.containsVertex(i); - - const LeafBoundaryPatch<ContinuumGridType>& continuumInterfaceBoundary - = complex_.coupling(std::make_pair("rod",name)).continuumInterfaceBoundary_; - - for (int i=0; i<dirichletAndCouplingNodes.size(); i++) { - bool v = continuumInterfaceBoundary.containsVertex(i); - for (int j=0; j<dim; j++) - dirichletAndCouplingNodes[i][j] = dirichletAndCouplingNodes[i][j] or v; + + // get the names of all the rods that we couple with + std::set<std::string> rodNames = rodsPerContinuum(name); + + for (std::set<std::string>::const_iterator rIt = rodNames.begin(); + rIt != rodNames.end(); + ++rIt) { + + const LeafBoundaryPatch<ContinuumGridType>& continuumInterfaceBoundary + = complex_.coupling(std::make_pair(*rIt,name)).continuumInterfaceBoundary_; + + for (int i=0; i<dirichletAndCouplingNodes.size(); i++) { + bool v = continuumInterfaceBoundary.containsVertex(i); + for (int j=0; j<dim; j++) + dirichletAndCouplingNodes[i][j] = dirichletAndCouplingNodes[i][j] or v; + } + } } } + + +template <class RodGridType, class ContinuumGridType> +std::set<std::string> RodContinuumSteklovPoincareStep<RodGridType,ContinuumGridType>:: +rodsPerContinuum(const std::string& name) const +{ + std::set<std::string> result; + for (typename RodContinuumComplex<RodGridType,ContinuumGridType>::ConstCouplingIterator it = complex_.couplings_.begin(); + it!=complex_.couplings_.end(); ++it) + if (it->first.second == name) + result.insert(it->first.first); + + return result; +} template <class RodGridType, class ContinuumGridType> RigidBodyMotion<3>::TangentVector RodContinuumSteklovPoincareStep<RodGridType,ContinuumGridType>::