diff --git a/src/SIM/SIM2D.C b/src/SIM/SIM2D.C index 63060fd5..9ed56552 100644 --- a/src/SIM/SIM2D.C +++ b/src/SIM/SIM2D.C @@ -70,7 +70,8 @@ SIM2D::SIM2D (IntegrandBase* itg, unsigned char n, bool check) : SIMgeneric(itg) bool SIM2D::addConnection (int master, int slave, int mIdx, - int sIdx, int orient, int basis, bool coordCheck) + int sIdx, int orient, int basis, + bool coordCheck, int dim) { if (orient < 0 || orient > 1) { std::cerr <<" *** SIM2D::addConnection: Invalid orientation "<< orient <<"." @@ -83,28 +84,30 @@ bool SIM2D::addConnection (int master, int slave, int mIdx, if (lmaster > 0 && lslave > 0) { - IFEM::cout <<"\tConnecting P"<< slave <<" E"<< sIdx - <<" to P"<< master <<" E"<< mIdx - <<" reversed? "<< orient << std::endl; + if (dim > 0) { + IFEM::cout <<"\tConnecting P"<< slave <<" E"<< sIdx + <<" to P"<< master <<" E"<< mIdx + <<" reversed? "<< orient << std::endl; - ASMs2D* spch = static_cast(myModel[lslave-1]); - ASMs2D* mpch = static_cast(myModel[lmaster-1]); + ASMs2D* spch = static_cast(myModel[lslave-1]); + ASMs2D* mpch = static_cast(myModel[lmaster-1]); - std::set bases; - if (basis == 0) - for (size_t b = 1; b <= spch->getNoBasis(); ++b) - bases.insert(b); - else - bases = utl::getDigits(basis); + std::set bases; + if (basis == 0) + for (size_t b = 1; b <= spch->getNoBasis(); ++b) + bases.insert(b); + else + bases = utl::getDigits(basis); - for (const int& b : bases) - if (!spch->connectPatch(sIdx,*mpch,mIdx,orient,b,coordCheck)) - return false; + for (const int& b : bases) + if (!spch->connectPatch(sIdx,*mpch,mIdx,orient,b,coordCheck)) + return false; + } } else adm.dd.ghostConnections.insert(DomainDecomposition::Interface{master, slave, mIdx, sIdx, - orient, 1, basis}); + orient, dim, basis}); return true; } @@ -199,7 +202,7 @@ bool SIM2D::parseGeometryTag (const TiXmlElement* elem) const TiXmlElement* child = elem->FirstChildElement("connection"); for (; child; child = child->NextSiblingElement()) { - int master = 0, slave = 0, mEdge = 0, sEdge = 0, orient = 0, basis = 0; + int master = 0, slave = 0, mEdge = 0, sEdge = 0, orient = 0, basis = 0, dim = 1; bool rever = false, periodic = false; utl::getAttribute(child,"master",master); if (!utl::getAttribute(child,"midx",mEdge)) @@ -212,6 +215,7 @@ bool SIM2D::parseGeometryTag (const TiXmlElement* elem) orient = 1; utl::getAttribute(child,"basis",basis); utl::getAttribute(child,"periodic",periodic); + utl::getAttribute(child,"dim",dim); if (master == slave || master < 1 || master > nGlPatches || @@ -222,7 +226,7 @@ bool SIM2D::parseGeometryTag (const TiXmlElement* elem) return false; } - if (!this->addConnection(master,slave,mEdge,sEdge,orient,basis,!periodic)) + if (!this->addConnection(master,slave,mEdge,sEdge,orient,basis,!periodic,dim)) { std::cerr <<" *** SIM2D::parse: Error establishing connection." << std::endl; diff --git a/src/SIM/SIM2D.h b/src/SIM/SIM2D.h index 5da34aa9..8c72983d 100644 --- a/src/SIM/SIM2D.h +++ b/src/SIM/SIM2D.h @@ -73,13 +73,16 @@ public: //! \brief Connect two patches. //! \param master Master patch //! \param slave Slave patch - //! \param mEdge Edge on master - //! \param sEdge Edge on slave + //! \param mIdx Index on master + //! \param sIdx Index on slave + //! \param basis Bases to connect (0 for all) //! \param orient Orientation flag for connection (1 for reversed) //! \param basis Which bases to connect (0 for all) //! \param coordCheck False to turn off coordinate checks + //! \param dim Dimensionality of connection bool addConnection(int master, int slave, int mEdge, int sEdge, - int orient, int basis = 0, bool coordCheck = true); + int orient, int basis = 0, bool coordCheck = true, + int dim = 1); //! \brief Evaluates the primary solution at the given point. //! \param[in] psol Primary solution vector diff --git a/src/SIM/SIM3D.C b/src/SIM/SIM3D.C index bdc30a39..241fbfb8 100644 --- a/src/SIM/SIM3D.C +++ b/src/SIM/SIM3D.C @@ -48,7 +48,8 @@ SIM3D::SIM3D (IntegrandBase* itg, unsigned char n, bool check) : SIMgeneric(itg) bool SIM3D::addConnection (int master, int slave, int mIdx, - int sIdx, int orient, int basis, bool coordCheck) + int sIdx, int orient, int basis, + bool coordCheck, int dim) { if (orient < 0 || orient > 7) { std::cerr <<" *** SIM3D::addConnection: Invalid orientation "<< orient <<"." @@ -60,27 +61,29 @@ bool SIM3D::addConnection (int master, int slave, int mIdx, int lslave = this->getLocalPatchIndex(slave); if (lmaster > 0 && lslave > 0) { - IFEM::cout <<"\tConnecting P"<< slave <<" F"<< sIdx - <<" to P"<< master <<" F"<< mIdx - <<" orient "<< orient << std::endl; + if (dim > 1) { + IFEM::cout <<"\tConnecting P"<< slave <<" F"<< sIdx + <<" to P"<< master <<" F"<< mIdx + <<" orient "<< orient << std::endl; - ASMs3D* spch = static_cast(myModel[lslave-1]); - ASMs3D* mpch = static_cast(myModel[lmaster-1]); + ASMs3D* spch = static_cast(myModel[lslave-1]); + ASMs3D* mpch = static_cast(myModel[lmaster-1]); - std::set bases; - if (basis == 0) - for (size_t b = 1; b <= spch->getNoBasis(); ++b) - bases.insert(b); - else - bases = utl::getDigits(basis); + std::set bases; + if (basis == 0) + for (size_t b = 1; b <= spch->getNoBasis(); ++b) + bases.insert(b); + else + bases = utl::getDigits(basis); - for (const int& b : bases) - if (!spch->connectPatch(sIdx,*mpch,mIdx,orient,b,coordCheck)) - return false; + for (const int& b : bases) + if (!spch->connectPatch(sIdx,*mpch,mIdx,orient,b,coordCheck)) + return false; + } } else adm.dd.ghostConnections.insert(DomainDecomposition::Interface{master, slave, mIdx, sIdx, - orient, 2, basis}); + orient, dim, basis}); return true; } @@ -178,15 +181,18 @@ bool SIM3D::parseGeometryTag (const TiXmlElement* elem) const TiXmlElement* child = elem->FirstChildElement("connection"); for (; child; child = child->NextSiblingElement()) { - int master = 0, slave = 0, mFace = 0, sFace = 0, orient = 0, basis = 0; + int master = 0, slave = 0, mIdx = 0, sIdx = 0, orient = 0, basis = 0, dim = 2; bool periodic = false; utl::getAttribute(child,"master",master); - utl::getAttribute(child,"mface",mFace); + if (!utl::getAttribute(child,"midx",mIdx)) + utl::getAttribute(child,"mface",mIdx); utl::getAttribute(child,"slave",slave); - utl::getAttribute(child,"sface",sFace); + if (!utl::getAttribute(child,"sidx",sIdx)) + utl::getAttribute(child,"sface",sIdx); utl::getAttribute(child,"orient",orient); utl::getAttribute(child,"basis",basis); utl::getAttribute(child,"periodic",periodic); + utl::getAttribute(child,"dim",dim); if (master == slave || master < 1 || master > nGlPatches || @@ -198,7 +204,7 @@ bool SIM3D::parseGeometryTag (const TiXmlElement* elem) } if (!this->addConnection(master, slave, mFace, sFace, - orient, basis, !periodic)) + orient, basis, !periodic, dim)) { std::cerr <<" *** SIM3D::parse: Error establishing connection." << std::endl; diff --git a/src/SIM/SIM3D.h b/src/SIM/SIM3D.h index b9b742ad..511c0e9a 100644 --- a/src/SIM/SIM3D.h +++ b/src/SIM/SIM3D.h @@ -68,13 +68,15 @@ public: //! \brief Connect two patches. //! \param master Master patch //! \param slave Slave patch - //! \param mFace Face on master - //! \param sFace Face on slave + //! \param mIdx Index on master + //! \param sIdx Index on slave //! \param orient Orientation flag for connection //! \param basis Which bases to connect (0 for all) //! \param coordCheck False to turn off coordinate checks + //! \param[in] dim Dimensionality of connection bool addConnection(int master, int slave, int mFace, int sFace, - int orient, int basis = 0, bool coordCheck = true); + int orient, int basis = 0, bool coordCheck = true, + int dim = 2); //! \brief Evaluates the primary solution at the given point. //! \param[in] psol Primary solution vector diff --git a/src/SIM/SIMbase.h b/src/SIM/SIMbase.h index 11c57ddd..f1d92f08 100644 --- a/src/SIM/SIMbase.h +++ b/src/SIM/SIMbase.h @@ -100,8 +100,10 @@ public: //! \param orient Orientation flag //! \param basis Which bases to connect (0 for all) //! \param coordCheck False to turn off coordinate checks. + //! \param dim Dimensionality of connection virtual bool addConnection(int master, int slave, int mIdx, int sIdx, - int orient, int basis = 0, bool coordCheck = true) + int orient, int basis = 0, bool coordCheck = true, + int dim = 1) { return false; } protected: