From bd46c44759c1b88ec62888eca1793c647fa8e7d4 Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Sat, 22 Jan 2011 17:41:11 +0000 Subject: [PATCH] centralize all information a RodContinuumComplex keeps about a rod in a special struct [[Imported from SVN: r6821]] --- dirneucoupling.cc | 28 +++++++++---------- dune/gfe/coupling/rodcontinuumcomplex.hh | 22 +++++++++------ .../rodcontinuumsteklovpoincarestep.hh | 2 +- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/dirneucoupling.cc b/dirneucoupling.cc index 090a07fb..da85afb2 100644 --- a/dirneucoupling.cc +++ b/dirneucoupling.cc @@ -128,7 +128,7 @@ int main (int argc, char *argv[]) try RodContinuumComplex<RodGridType,GridType> complex; - complex.rodGrids_["rod"] = shared_ptr<RodGridType> + complex.rods_["rod"].grid_ = shared_ptr<RodGridType> (new RodGridType(numRodBaseElements, 0, (rodRestEndPoint[1]-rodRestEndPoint[0]).two_norm())); complex.continuumGrids_["continuum"] = shared_ptr<GridType>(AmiraMeshReader<GridType>::read(path + objectName)); @@ -140,18 +140,18 @@ int main (int argc, char *argv[]) try // Globally refine grids // ////////////////////////////////////// - complex.rodGrids_["rod"]->globalRefine(numLevels-1); + complex.rods_["rod"].grid_->globalRefine(numLevels-1); complex.continuumGrids_["continuum"]->globalRefine(numLevels-1); - RodSolutionType rodX(complex.rodGrids_["rod"]->size(1)); + RodSolutionType rodX(complex.rods_["rod"].grid_->size(1)); - int toplevel = complex.rodGrids_["rod"]->maxLevel(); + int toplevel = complex.rods_["rod"].grid_->maxLevel(); // ////////////////////////// // Initial solution // ////////////////////////// - RodFactory<RodGridType::LeafGridView> rodFactory(complex.rodGrids_["rod"]->leafView()); + RodFactory<RodGridType::LeafGridView> rodFactory(complex.rods_["rod"].grid_->leafView()); rodFactory.create(rodX, rodRestEndPoint[0], rodRestEndPoint[1]); // ///////////////////////////////////////// @@ -164,13 +164,13 @@ int main (int argc, char *argv[]) try rodX.back().q = Rotation<3,double>(axis, M_PI*angle/180); - rodFactory.create(complex.rodDirichletValues_["rod"], + rodFactory.create(complex.rods_["rod"].dirichletValues_, RigidBodyMotion<3>(FieldVector<double,3>(0), Rotation<3,double>::identity())); - complex.rodDirichletValues_["rod"].back() = RigidBodyMotion<3>(parameterSet.get("dirichletValue", rodRestEndPoint[1]), + complex.rods_["rod"].dirichletValues_.back() = RigidBodyMotion<3>(parameterSet.get("dirichletValue", rodRestEndPoint[1]), Rotation<3,double>(axis, M_PI*angle/180)); - BitSetVector<1> rodDNodes(complex.rodDirichletValues_["rod"].size(), false); + BitSetVector<1> rodDNodes(complex.rods_["rod"].dirichletValues_.size(), false); rodDNodes.back() = true; - complex.rodDirichletBoundaries_["rod"].setup(*complex.rodGrids_["rod"],rodDNodes); + complex.rods_["rod"].dirichletBoundary_.setup(*complex.rods_["rod"].grid_,rodDNodes); // Backup initial rod iterate for later reference RodSolutionType initialIterateRod = rodX; @@ -208,7 +208,7 @@ int main (int argc, char *argv[]) try BitSetVector<1> rodCouplingBitfield(rodX.size(),false); // Using that index 0 is always the left boundary for a uniformly refined OneDGrid rodCouplingBitfield[0] = true; - complex.couplings_[interfaceName].rodInterfaceBoundary_.setup(*complex.rodGrids_["rod"], rodCouplingBitfield); + complex.couplings_[interfaceName].rodInterfaceBoundary_.setup(*complex.rods_["rod"].grid_, rodCouplingBitfield); // then for the continuum LevelBoundaryPatch<GridType> coarseInterfaceBoundary(*complex.continuumGrids_["continuum"], 0); @@ -250,7 +250,7 @@ int main (int argc, char *argv[]) try // Dirichlet nodes for the rod problem // /////////////////////////////////////////// - BitSetVector<6> rodDirichletNodes(complex.rodGrids_["rod"]->size(1)); + BitSetVector<6> rodDirichletNodes(complex.rods_["rod"].grid_->size(1)); rodDirichletNodes.unsetAll(); rodDirichletNodes[0] = true; @@ -260,13 +260,13 @@ int main (int argc, char *argv[]) try // Create a solver for the rod problem // /////////////////////////////////////////// - RodLocalStiffness<RodGridType::LeafGridView,double> rodLocalStiffness(complex.rodGrids_["rod"]->leafView(), + RodLocalStiffness<RodGridType::LeafGridView,double> rodLocalStiffness(complex.rods_["rod"].grid_->leafView(), rodA, rodJ1, rodJ2, rodE, rodNu); - RodAssembler<RodGridType::LeafGridView,3> rodAssembler(complex.rodGrids_["rod"]->leafView(), &rodLocalStiffness); + RodAssembler<RodGridType::LeafGridView,3> rodAssembler(complex.rods_["rod"].grid_->leafView(), &rodLocalStiffness); RiemannianTrustRegionSolver<RodGridType,RigidBodyMotion<3> > rodSolver; - rodSolver.setup(*complex.rodGrids_["rod"], + rodSolver.setup(*complex.rods_["rod"].grid_, &rodAssembler, rodX, rodDirichletNodes, diff --git a/dune/gfe/coupling/rodcontinuumcomplex.hh b/dune/gfe/coupling/rodcontinuumcomplex.hh index f4edddb2..0dce17bf 100644 --- a/dune/gfe/coupling/rodcontinuumcomplex.hh +++ b/dune/gfe/coupling/rodcontinuumcomplex.hh @@ -28,13 +28,23 @@ class RodContinuumComplex LeafBoundaryPatch<ContinuumGrid> continuumInterfaceBoundary_; }; + /** \brief Holds all data for a rod subproblem */ + struct RodData + { + Dune::shared_ptr<RodGrid> grid_; + + LeafBoundaryPatch<RodGrid> dirichletBoundary_; + + RodConfiguration dirichletValues_; + }; + public: /** \brief Simple const access to rod grids */ const Dune::shared_ptr<RodGrid> rodGrid(const std::string& name) const { - assert(rodGrids_.find(name) != rodGrids_.end()); - return rodGrids_.find(name)->second; + assert(rods_.find(name) != rods_.end()); + return rods_.find(name)->second.grid_; } /** \brief Simple const access to continuum grids */ @@ -62,13 +72,7 @@ public: ///////////////////////////////////////////////////////////////////// /** \brief The set of rods, accessible by name (string) */ - std::map<std::string, Dune::shared_ptr<RodGrid> > rodGrids_; - - /** \brief A Dirichlet boundary for each rod */ - std::map<std::string, LeafBoundaryPatch<RodGrid> > rodDirichletBoundaries_; - - /** \brief The Dirichlet values for each rod */ - std::map<std::string, RodConfiguration> rodDirichletValues_; + std::map<std::string, RodData > rods_; ///////////////////////////////////////////////////////////////////// // Data concerning the individual continuum problems diff --git a/dune/gfe/coupling/rodcontinuumsteklovpoincarestep.hh b/dune/gfe/coupling/rodcontinuumsteklovpoincarestep.hh index fe7fd337..b15f2707 100644 --- a/dune/gfe/coupling/rodcontinuumsteklovpoincarestep.hh +++ b/dune/gfe/coupling/rodcontinuumsteklovpoincarestep.hh @@ -393,7 +393,7 @@ rodDirichletToNeumannMap(const RigidBodyMotion<3>& lambda) const { // Create an initial iterate by interpolating between lambda and the Dirichlet value /** \todo Using that the coupling boundary is the one with the lower coordinate */ - RigidBodyMotion<3> rodDirichletValue = complex_.rodDirichletValues_.find("rod")->second.back(); + RigidBodyMotion<3> rodDirichletValue = complex_.rods_.find("rod")->second.dirichletValues_.back(); // Set initial iterate RodConfigurationType& rodX = rodSubdomainSolutions_["rod"]; -- GitLab