Added: basis and option to skip coordinate check in connection establishment

Needed for periodicity establishment (all bases are not necessarily periodic).
This commit is contained in:
Arne Morten Kvarving 2016-05-16 01:05:48 +02:00 committed by Knut Morten Okstad
parent 1045f7df04
commit a172307315
8 changed files with 53 additions and 34 deletions

View File

@ -590,7 +590,8 @@ bool ASMs2D::assignNodeNumbers (BlockNodes& nodes, int basis)
} }
bool ASMs2D::connectPatch (int edge, ASMs2D& neighbor, int nedge, bool revers) bool ASMs2D::connectPatch (int edge, ASMs2D& neighbor, int nedge,
bool revers, int, bool coordCheck)
{ {
if (swapV && edge > 2) // Account for swapped parameter direction if (swapV && edge > 2) // Account for swapped parameter direction
edge = 7-edge; edge = 7-edge;
@ -598,7 +599,7 @@ bool ASMs2D::connectPatch (int edge, ASMs2D& neighbor, int nedge, bool revers)
if (neighbor.swapV && nedge > 2) // Account for swapped parameter direction if (neighbor.swapV && nedge > 2) // Account for swapped parameter direction
nedge = 7-nedge; nedge = 7-nedge;
if (!this->connectBasis(edge,neighbor,nedge,revers)) if (!this->connectBasis(edge,neighbor,nedge,revers,1,0,0,coordCheck))
return false; return false;
this->addNeighbor(&neighbor); this->addNeighbor(&neighbor);
@ -607,7 +608,7 @@ bool ASMs2D::connectPatch (int edge, ASMs2D& neighbor, int nedge, bool revers)
bool ASMs2D::connectBasis (int edge, ASMs2D& neighbor, int nedge, bool revers, bool ASMs2D::connectBasis (int edge, ASMs2D& neighbor, int nedge, bool revers,
int basis, int slave, int master) int basis, int slave, int master, bool coordCheck)
{ {
if (this->isShared() && neighbor.isShared()) if (this->isShared() && neighbor.isShared())
return true; return true;
@ -687,7 +688,7 @@ bool ASMs2D::connectBasis (int edge, ASMs2D& neighbor, int nedge, bool revers,
for (i = 0; i < n1; i++, node += i1) for (i = 0; i < n1; i++, node += i1)
{ {
int slave = slaveNodes[revers ? n1-i-1 : i]; int slave = slaveNodes[revers ? n1-i-1 : i];
if (!neighbor.getCoord(node).equal(this->getCoord(slave),xtol)) if (coordCheck && !neighbor.getCoord(node).equal(this->getCoord(slave),xtol))
{ {
std::cerr <<" *** ASMs2D::connectPatch: Non-matching nodes " std::cerr <<" *** ASMs2D::connectPatch: Non-matching nodes "
<< node <<": "<< neighbor.getCoord(node) << node <<": "<< neighbor.getCoord(node)

View File

@ -267,8 +267,9 @@ public:
//! \param neighbor The neighbor patch //! \param neighbor The neighbor patch
//! \param[in] nedge Local edge index of neighbor patch, in range [1,4] //! \param[in] nedge Local edge index of neighbor patch, in range [1,4]
//! \param[in] revers Indicates whether the two edges have opposite directions //! \param[in] revers Indicates whether the two edges have opposite directions
virtual bool connectPatch(int edge, ASMs2D& neighbor, int nedge, //! \param[in] coordCheck False to disable coordinate checks (periodic connections)
bool revers = false); virtual bool connectPatch(int edge, ASMs2D& neighbor, int nedge, bool revers,
int = 0, bool coordCheck = true);
//! \brief Makes two opposite boundary edges periodic. //! \brief Makes two opposite boundary edges periodic.
//! \param[in] dir Parameter direction defining the periodic edges //! \param[in] dir Parameter direction defining the periodic edges
@ -473,8 +474,10 @@ protected:
//! \param[in] basis Which basis to connect the nodes for (mixed methods) //! \param[in] basis Which basis to connect the nodes for (mixed methods)
//! \param[in] slave 0-based index of the first slave node in this basis //! \param[in] slave 0-based index of the first slave node in this basis
//! \param[in] master 0-based index of the first master node in this basis //! \param[in] master 0-based index of the first master node in this basis
//! \param[in] coordCheck False to disable coordinate checks (periodic connections)
bool connectBasis(int edge, ASMs2D& neighbor, int nedge, bool revers, bool connectBasis(int edge, ASMs2D& neighbor, int nedge, bool revers,
int basis = 1, int slave = 0, int master = 0); int basis = 1, int slave = 0, int master = 0,
bool coordCheck = true);
//! \brief Extracts parameter values of the Gauss points in one direction. //! \brief Extracts parameter values of the Gauss points in one direction.
//! \param[out] uGP Parameter values in given direction for all points //! \param[out] uGP Parameter values in given direction for all points

View File

@ -292,30 +292,32 @@ bool ASMs2Dmx::generateFEMTopology ()
} }
bool ASMs2Dmx::connectPatch (int edge, ASMs2D& neighbor, int nedge, bool revers) bool ASMs2Dmx::connectPatch (int edge, ASMs2D& neighbor, int nedge, bool revers,
int basis, bool coordCheck)
{ {
ASMs2Dmx* neighMx = dynamic_cast<ASMs2Dmx*>(&neighbor); ASMs2Dmx* neighMx = dynamic_cast<ASMs2Dmx*>(&neighbor);
if (!neighMx) return false; if (!neighMx) return false;
size_t nb1=0; size_t nb1 = 0, nb2 = 0;
size_t nb2=0; for (size_t i = 1; i <= m_basis.size(); ++i) {
this->addNeighbor(neighMx); if (basis == 0 || i == (size_t)basis)
for (size_t i = 1;i <= m_basis.size(); ++i) { if (!this->connectBasis(edge,neighbor,nedge,revers,i,nb1,nb2,coordCheck))
if (!this->connectBasis(edge,neighbor,nedge,revers,i,nb1,nb2)) return false;
return false;
nb1 += nb[i-1]; nb1 += nb[i-1];
nb2 += neighMx->nb[i-1]; nb2 += neighMx->nb[i-1];
} }
this->addNeighbor(neighMx);
return true; return true;
} }
void ASMs2Dmx::closeEdges (int dir, int, int) void ASMs2Dmx::closeEdges (int dir, int, int)
{ {
size_t nbi = 0; size_t nbi = 1;
for (size_t i = 1;i <= m_basis.size(); ++i) { for (size_t i = 1;i <= m_basis.size(); ++i) {
this->ASMs2D::closeEdges(dir,i,nbi+1); this->ASMs2D::closeEdges(dir,i,nbi);
nbi += nb[i-1]; nbi += nb[i-1];
} }
} }

View File

@ -101,8 +101,10 @@ public:
//! \param neighbor The neighbor patch //! \param neighbor The neighbor patch
//! \param[in] nedge Local edge index of neighbor patch, in range [1,4] //! \param[in] nedge Local edge index of neighbor patch, in range [1,4]
//! \param[in] revers Indicates whether the two edges have opposite directions //! \param[in] revers Indicates whether the two edges have opposite directions
virtual bool connectPatch(int edge, ASMs2D& neighbor, int nedge, //! \param[in] basis The basis to connect (for mixed problems)
bool revers = false); //! \param[in] coordCheck False to disable coordinate checks (periodic connections)
virtual bool connectPatch(int edge, ASMs2D& neighbor, int nedge, bool revers,
int basis = 0, bool coordCheck = true);
//! \brief Makes two opposite boundary edges periodic. //! \brief Makes two opposite boundary edges periodic.
//! \param[in] dir Parameter direction defining the periodic edges //! \param[in] dir Parameter direction defining the periodic edges

View File

@ -616,7 +616,8 @@ bool ASMs3D::assignNodeNumbers (BlockNodes& nodes, int basis)
} }
bool ASMs3D::connectPatch (int face, ASMs3D& neighbor, int nface, int norient) bool ASMs3D::connectPatch (int face, ASMs3D& neighbor, int nface,
int norient, int, bool coordCheck)
{ {
if (swapW && face > 4) // Account for swapped parameter direction if (swapW && face > 4) // Account for swapped parameter direction
face = 11-face; face = 11-face;
@ -624,7 +625,7 @@ bool ASMs3D::connectPatch (int face, ASMs3D& neighbor, int nface, int norient)
if (neighbor.swapW && nface > 4) // Account for swapped parameter direction if (neighbor.swapW && nface > 4) // Account for swapped parameter direction
nface = 11-nface; nface = 11-nface;
if (!this->connectBasis(face,neighbor,nface,norient)) if (!this->connectBasis(face,neighbor,nface,norient,1,0,0,coordCheck))
return false; return false;
this->addNeighbor(&neighbor); this->addNeighbor(&neighbor);
@ -633,7 +634,7 @@ bool ASMs3D::connectPatch (int face, ASMs3D& neighbor, int nface, int norient)
bool ASMs3D::connectBasis (int face, ASMs3D& neighbor, int nface, int norient, bool ASMs3D::connectBasis (int face, ASMs3D& neighbor, int nface, int norient,
int basis, int slave, int master) int basis, int slave, int master, bool coordCheck)
{ {
if (this->isShared() && neighbor.isShared()) if (this->isShared() && neighbor.isShared())
return true; return true;
@ -755,7 +756,7 @@ bool ASMs3D::connectBasis (int face, ASMs3D& neighbor, int nface, int norient,
} }
int slave = slaveNodes[k][l]; int slave = slaveNodes[k][l];
if (!neighbor.getCoord(node).equal(this->getCoord(slave),xtol)) if (coordCheck && !neighbor.getCoord(node).equal(this->getCoord(slave),xtol))
{ {
std::cerr <<" *** ASMs3D::connectPatch: Non-matching nodes " std::cerr <<" *** ASMs3D::connectPatch: Non-matching nodes "
<< node <<": "<< neighbor.getCoord(node) << node <<": "<< neighbor.getCoord(node)

View File

@ -317,13 +317,15 @@ public:
//! \param neighbor The neighbor patch //! \param neighbor The neighbor patch
//! \param[in] nface Local face index of neighbor patch, in range [1,6] //! \param[in] nface Local face index of neighbor patch, in range [1,6]
//! \param[in] norient Relative face orientation flag (see below) //! \param[in] norient Relative face orientation flag (see below)
//! \param[in] coordCheck False to disable coordinate checks (periodic connections)
//! //!
//! \details The face orientation flag \a norient must be in range [0,7]. //! \details The face orientation flag \a norient must be in range [0,7].
//! When interpreted as a binary number, its 3 digits are decoded as follows: //! When interpreted as a binary number, its 3 digits are decoded as follows:
//! - left digit = 1: The u and v parameters of the neighbor face are swapped //! - left digit = 1: The u and v parameters of the neighbor face are swapped
//! - middle digit = 1: Parameter \a u in neighbor patch face is reversed //! - middle digit = 1: Parameter \a u in neighbor patch face is reversed
//! - right digit = 1: Parameter \a v in neighbor patch face is reversed //! - right digit = 1: Parameter \a v in neighbor patch face is reversed
virtual bool connectPatch(int face, ASMs3D& neighbor, int nface, int norient); virtual bool connectPatch(int face, ASMs3D& neighbor, int nface, int norient,
int = 0, bool coordCheck = true);
//! \brief Makes two opposite boundary faces periodic. //! \brief Makes two opposite boundary faces periodic.
//! \param[in] dir Parameter direction defining the periodic faces //! \param[in] dir Parameter direction defining the periodic faces
@ -533,8 +535,10 @@ protected:
//! \param[in] basis Which basis to connect the nodes for (mixed methods) //! \param[in] basis Which basis to connect the nodes for (mixed methods)
//! \param[in] slave 0-based index of the first slave node in this basis //! \param[in] slave 0-based index of the first slave node in this basis
//! \param[in] master 0-based index of the first master node in this basis //! \param[in] master 0-based index of the first master node in this basis
//! \param[in] coordCheck False to turn off coordinate checks
bool connectBasis(int face, ASMs3D& neighbor, int nface, int norient, bool connectBasis(int face, ASMs3D& neighbor, int nface, int norient,
int basis = 1, int slave = 0, int master = 0); int basis = 1, int slave = 0, int master = 0,
bool coordCheck = true);
//! \brief Extracts parameter values of the Gauss points in one direction. //! \brief Extracts parameter values of the Gauss points in one direction.
//! \param[out] uGP Parameter values in given direction for all points //! \param[out] uGP Parameter values in given direction for all points

View File

@ -298,7 +298,8 @@ bool ASMs3Dmx::generateFEMTopology ()
} }
bool ASMs3Dmx::connectPatch (int face, ASMs3D& neighbor, int nface, int norient) bool ASMs3Dmx::connectPatch (int face, ASMs3D& neighbor, int nface, int norient,
int basis, bool coordCheck)
{ {
ASMs3Dmx* neighMx = dynamic_cast<ASMs3Dmx*>(&neighbor); ASMs3Dmx* neighMx = dynamic_cast<ASMs3Dmx*>(&neighbor);
if (!neighMx) return false; if (!neighMx) return false;
@ -309,11 +310,14 @@ bool ASMs3Dmx::connectPatch (int face, ASMs3D& neighbor, int nface, int norient)
if (neighMx->swapW && face > 4) // Account for swapped parameter direction if (neighMx->swapW && face > 4) // Account for swapped parameter direction
nface = 11-nface; nface = 11-nface;
size_t nbi=0; size_t nb1 = 0, nb2 = 0;
for (size_t i = 1;i <= m_basis.size(); ++i) { for (size_t i = 1; i <= m_basis.size(); ++i) {
if (!this->connectBasis(face,neighbor,nface,norient,i,nbi,nbi)) if (basis == 0 || i == (size_t)basis)
return false; if (!this->connectBasis(face,neighbor,nface,norient,i,nb1,nb2,coordCheck))
nbi += nb[i-1]; return false;
nb1 += nb[i-1];
nb2 += neighMx->nb[i-1];
} }
this->addNeighbor(neighMx); this->addNeighbor(neighMx);
@ -323,9 +327,9 @@ bool ASMs3Dmx::connectPatch (int face, ASMs3D& neighbor, int nface, int norient)
void ASMs3Dmx::closeFaces (int dir, int, int) void ASMs3Dmx::closeFaces (int dir, int, int)
{ {
size_t nbi = 0; size_t nbi = 1;
for (size_t i = 1;i <= m_basis.size(); ++i) { for (size_t i = 1;i <= m_basis.size(); ++i) {
this->ASMs3D::closeFaces(dir,i,nbi+1); this->ASMs3D::closeFaces(dir,i,nbi);
nbi += nb[i-1]; nbi += nb[i-1];
} }
} }

View File

@ -94,8 +94,10 @@ public:
//! \param neighbor The neighbor patch //! \param neighbor The neighbor patch
//! \param[in] nface Local face index of neighbor patch, in range [1,6] //! \param[in] nface Local face index of neighbor patch, in range [1,6]
//! \param[in] norient Relative face orientation flag (see class ASMs3D) //! \param[in] norient Relative face orientation flag (see class ASMs3D)
virtual bool connectPatch(int face, ASMs3D& neighbor, int nface, //! \param[in] basis Which basis to connect, or 0 for all.
int norient = 0); //! \param[in] coordCheck False to disable coordinate checks (periodic connections)
virtual bool connectPatch(int face, ASMs3D& neighbor, int nface, int norient,
int basis = 0, bool coordCheck = true);
//! \brief Makes two opposite boundary faces periodic. //! \brief Makes two opposite boundary faces periodic.
//! \param[in] dir Parameter direction defining the periodic faces //! \param[in] dir Parameter direction defining the periodic faces