added: new format for topology connection tags

use <connection master=".." midx=".." slave=".." sidx=".." dim="2"/>
instead of <connection master=".." mface=".." slave=".." sface=".."/>

use <connection master=".." midx=".." slave=".." sidx=".." dim="1"/>
instead of <connection master=".." medge=".." slave=".." sedge=".."/>

this allows for encoding vertex and edge connections in 2D/3D and
edge connections in 3D using the same format.
This commit is contained in:
Arne Morten Kvarving 2016-08-30 10:19:31 +02:00
parent a3b635c371
commit 8d5dddf382
5 changed files with 62 additions and 45 deletions

View File

@ -70,7 +70,8 @@ SIM2D::SIM2D (IntegrandBase* itg, unsigned char n, bool check) : SIMgeneric(itg)
bool SIM2D::addConnection (int master, int slave, int mIdx, 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) { if (orient < 0 || orient > 1) {
std::cerr <<" *** SIM2D::addConnection: Invalid orientation "<< orient <<"." std::cerr <<" *** SIM2D::addConnection: Invalid orientation "<< orient <<"."
@ -83,6 +84,7 @@ bool SIM2D::addConnection (int master, int slave, int mIdx,
if (lmaster > 0 && lslave > 0) if (lmaster > 0 && lslave > 0)
{ {
if (dim > 0) {
IFEM::cout <<"\tConnecting P"<< slave <<" E"<< sIdx IFEM::cout <<"\tConnecting P"<< slave <<" E"<< sIdx
<<" to P"<< master <<" E"<< mIdx <<" to P"<< master <<" E"<< mIdx
<<" reversed? "<< orient << std::endl; <<" reversed? "<< orient << std::endl;
@ -101,10 +103,11 @@ bool SIM2D::addConnection (int master, int slave, int mIdx,
if (!spch->connectPatch(sIdx,*mpch,mIdx,orient,b,coordCheck)) if (!spch->connectPatch(sIdx,*mpch,mIdx,orient,b,coordCheck))
return false; return false;
} }
}
else else
adm.dd.ghostConnections.insert(DomainDecomposition::Interface{master, slave, adm.dd.ghostConnections.insert(DomainDecomposition::Interface{master, slave,
mIdx, sIdx, mIdx, sIdx,
orient, 1, basis}); orient, dim, basis});
return true; return true;
} }
@ -199,7 +202,7 @@ bool SIM2D::parseGeometryTag (const TiXmlElement* elem)
const TiXmlElement* child = elem->FirstChildElement("connection"); const TiXmlElement* child = elem->FirstChildElement("connection");
for (; child; child = child->NextSiblingElement()) 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; bool rever = false, periodic = false;
utl::getAttribute(child,"master",master); utl::getAttribute(child,"master",master);
if (!utl::getAttribute(child,"midx",mEdge)) if (!utl::getAttribute(child,"midx",mEdge))
@ -212,6 +215,7 @@ bool SIM2D::parseGeometryTag (const TiXmlElement* elem)
orient = 1; orient = 1;
utl::getAttribute(child,"basis",basis); utl::getAttribute(child,"basis",basis);
utl::getAttribute(child,"periodic",periodic); utl::getAttribute(child,"periodic",periodic);
utl::getAttribute(child,"dim",dim);
if (master == slave || if (master == slave ||
master < 1 || master > nGlPatches || master < 1 || master > nGlPatches ||
@ -222,7 +226,7 @@ bool SIM2D::parseGeometryTag (const TiXmlElement* elem)
return false; 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::cerr <<" *** SIM2D::parse: Error establishing connection."
<< std::endl; << std::endl;

View File

@ -73,13 +73,16 @@ public:
//! \brief Connect two patches. //! \brief Connect two patches.
//! \param master Master patch //! \param master Master patch
//! \param slave Slave patch //! \param slave Slave patch
//! \param mEdge Edge on master //! \param mIdx Index on master
//! \param sEdge Edge on slave //! \param sIdx Index on slave
//! \param basis Bases to connect (0 for all)
//! \param orient Orientation flag for connection (1 for reversed) //! \param orient Orientation flag for connection (1 for reversed)
//! \param basis Which bases to connect (0 for all) //! \param basis Which bases to connect (0 for all)
//! \param coordCheck False to turn off coordinate checks //! \param coordCheck False to turn off coordinate checks
//! \param dim Dimensionality of connection
bool addConnection(int master, int slave, int mEdge, int sEdge, 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. //! \brief Evaluates the primary solution at the given point.
//! \param[in] psol Primary solution vector //! \param[in] psol Primary solution vector

View File

@ -48,7 +48,8 @@ SIM3D::SIM3D (IntegrandBase* itg, unsigned char n, bool check) : SIMgeneric(itg)
bool SIM3D::addConnection (int master, int slave, int mIdx, 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) { if (orient < 0 || orient > 7) {
std::cerr <<" *** SIM3D::addConnection: Invalid orientation "<< orient <<"." std::cerr <<" *** SIM3D::addConnection: Invalid orientation "<< orient <<"."
@ -60,6 +61,7 @@ bool SIM3D::addConnection (int master, int slave, int mIdx,
int lslave = this->getLocalPatchIndex(slave); int lslave = this->getLocalPatchIndex(slave);
if (lmaster > 0 && lslave > 0) if (lmaster > 0 && lslave > 0)
{ {
if (dim > 1) {
IFEM::cout <<"\tConnecting P"<< slave <<" F"<< sIdx IFEM::cout <<"\tConnecting P"<< slave <<" F"<< sIdx
<<" to P"<< master <<" F"<< mIdx <<" to P"<< master <<" F"<< mIdx
<<" orient "<< orient << std::endl; <<" orient "<< orient << std::endl;
@ -77,10 +79,11 @@ bool SIM3D::addConnection (int master, int slave, int mIdx,
for (const int& b : bases) for (const int& b : bases)
if (!spch->connectPatch(sIdx,*mpch,mIdx,orient,b,coordCheck)) if (!spch->connectPatch(sIdx,*mpch,mIdx,orient,b,coordCheck))
return false; return false;
}
} else } else
adm.dd.ghostConnections.insert(DomainDecomposition::Interface{master, slave, adm.dd.ghostConnections.insert(DomainDecomposition::Interface{master, slave,
mIdx, sIdx, mIdx, sIdx,
orient, 2, basis}); orient, dim, basis});
return true; return true;
} }
@ -178,15 +181,18 @@ bool SIM3D::parseGeometryTag (const TiXmlElement* elem)
const TiXmlElement* child = elem->FirstChildElement("connection"); const TiXmlElement* child = elem->FirstChildElement("connection");
for (; child; child = child->NextSiblingElement()) 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; bool periodic = false;
utl::getAttribute(child,"master",master); 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,"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,"orient",orient);
utl::getAttribute(child,"basis",basis); utl::getAttribute(child,"basis",basis);
utl::getAttribute(child,"periodic",periodic); utl::getAttribute(child,"periodic",periodic);
utl::getAttribute(child,"dim",dim);
if (master == slave || if (master == slave ||
master < 1 || master > nGlPatches || master < 1 || master > nGlPatches ||
@ -198,7 +204,7 @@ bool SIM3D::parseGeometryTag (const TiXmlElement* elem)
} }
if (!this->addConnection(master, slave, mFace, sFace, if (!this->addConnection(master, slave, mFace, sFace,
orient, basis, !periodic)) orient, basis, !periodic, dim))
{ {
std::cerr <<" *** SIM3D::parse: Error establishing connection." std::cerr <<" *** SIM3D::parse: Error establishing connection."
<< std::endl; << std::endl;

View File

@ -68,13 +68,15 @@ public:
//! \brief Connect two patches. //! \brief Connect two patches.
//! \param master Master patch //! \param master Master patch
//! \param slave Slave patch //! \param slave Slave patch
//! \param mFace Face on master //! \param mIdx Index on master
//! \param sFace Face on slave //! \param sIdx Index on slave
//! \param orient Orientation flag for connection //! \param orient Orientation flag for connection
//! \param basis Which bases to connect (0 for all) //! \param basis Which bases to connect (0 for all)
//! \param coordCheck False to turn off coordinate checks //! \param coordCheck False to turn off coordinate checks
//! \param[in] dim Dimensionality of connection
bool addConnection(int master, int slave, int mFace, int sFace, 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. //! \brief Evaluates the primary solution at the given point.
//! \param[in] psol Primary solution vector //! \param[in] psol Primary solution vector

View File

@ -100,8 +100,10 @@ public:
//! \param orient Orientation flag //! \param orient Orientation flag
//! \param basis Which bases to connect (0 for all) //! \param basis Which bases to connect (0 for all)
//! \param coordCheck False to turn off coordinate checks. //! \param coordCheck False to turn off coordinate checks.
//! \param dim Dimensionality of connection
virtual bool addConnection(int master, int slave, int mIdx, int sIdx, 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; } { return false; }
protected: protected: