Fixed: Interpretation of the dof flag when constraining C1-patches

This commit is contained in:
Knut Morten Okstad 2018-05-03 08:59:24 +02:00
parent 133ccdc309
commit 45bee0621a
2 changed files with 29 additions and 38 deletions

View File

@ -31,13 +31,13 @@ bool ASMs1DC1::generateFEMTopology ()
int ASMs1DC1::constrainNode (double xi, int dof, int code, char basis) int ASMs1DC1::constrainNode (double xi, int dof, int code, char basis)
{ {
int node = this->ASMs1D::constrainNode(xi,dof%1000,code,basis); int node = this->ASMs1D::constrainNode(xi,dof%1000,code,basis);
if (node > 0 && dof > 1000 && code == 0) if (node > 0 && dof >= 1000 && code == 0)
{ {
// Also fix the (up to two) neighboring nodes // Also fix the (up to two) neighboring nodes
if (node > 1) if (node > 1)
this->prescribe(node-1,dof%1000,code); this->prescribe(node-1,dof/1000,code);
if (node < this->getSize(basis)) if (node < this->getSize(basis))
this->prescribe(node+1,dof%1000,code); this->prescribe(node+1,dof/1000,code);
} }
return node; return node;

View File

@ -189,17 +189,16 @@ void ASMs2DC1::constrainEdge (int dir, bool open, int dof, int code, char)
{ {
if (open && (i2 == 1 || i2 == n2)) if (open && (i2 == 1 || i2 == n2))
continue; // Skip the end points continue; // Skip the end points
else if (dof%1000)
this->prescribe(node,dof%1000,code); this->prescribe(node,dof%1000,code);
if (dof >= 1000) if (dof < 1000) continue;
{
if (dof%1000 && code == 0) if (dof%1000 && code == 0)
// The edge is clamped, fix the neighboring node line // The edge is clamped, fix the neighboring node line
this->prescribe(node-dir,dof/1000,0); this->prescribe(node-dir,dof/1000,0);
else for (int ldof : utl::getDigits(dof/1000)) else for (int ldof : utl::getDigits(dof/1000))
// The edge has a prescribed rotation, add an MPC for that // The edge has a prescribed rotation, add an MPC for that
this->add2PC(MLGN[node-dir-1],ldof,MLGN[node-1],code); this->add2PC(MLGN[node-dir-1],ldof,MLGN[node-1],code);
}
} }
break; break;
@ -210,17 +209,16 @@ void ASMs2DC1::constrainEdge (int dir, bool open, int dof, int code, char)
{ {
if (open && (i1 == 1 || i1 == n1)) if (open && (i1 == 1 || i1 == n1))
continue; // Skip the end points continue; // Skip the end points
else if (dof%1000)
this->prescribe(node,dof%1000,code); this->prescribe(node,dof%1000,code);
if (dof >= 1000) if (dof < 1000) continue;
{
if (dof%1000 && code == 0) if (dof%1000 && code == 0)
// Edge is clamped, fix the neighboring node line // Edge is clamped, fix the neighboring node line
this->prescribe(node-n1*dir/2,dof/1000,0); this->prescribe(node-n1*dir/2,dof/1000,0);
else for (int ldof : utl::getDigits(dof/1000)) else for (int ldof : utl::getDigits(dof/1000))
// The edge has a prescribed rotation, add an MPC for that // The edge has a prescribed rotation, add an MPC for that
this->add2PC(MLGN[node-n1*dir/2-1],ldof,MLGN[node-1],code); this->add2PC(MLGN[node-n1*dir/2-1],ldof,MLGN[node-1],code);
}
} }
break; break;
} }
@ -240,15 +238,8 @@ void ASMs2DC1::constrainCorner (int I, int J, int dof, int code)
if (dof < 1000 || code > 0) return; if (dof < 1000 || code > 0) return;
// Also fix the two neighboring nodes // Also fix the two neighboring nodes
if (I > 0) this->prescribe(I > 0 ? node-1 : node+1 , dof/1000,0);
this->prescribe(node-1,dof%1000,0); this->prescribe(J > 1 ? node-n1 : node+n1, dof/1000,0);
else
this->prescribe(node+1,dof%1000,0);
if (J > 0)
this->prescribe(node-n1,dof%1000,0);
else
this->prescribe(node+n1,dof%1000,0);
} }
@ -266,10 +257,10 @@ void ASMs2DC1::constrainNode (double xi, double eta, int dof, int code)
if (dof < 1000 || code > 0) return; if (dof < 1000 || code > 0) return;
// Also fix the (up to four) neighboring nodes // Also fix the (up to four) neighboring nodes
if (I > 0) this->prescribe(n1*J+I ,dof%1000,0); if (I > 0) this->prescribe(n1*J+I ,dof/1000,0);
if (I < n1-1) this->prescribe(n1*J+I+2 ,dof%1000,0); if (I < n1-1) this->prescribe(n1*J+I+2 ,dof/1000,0);
if (J > 0) this->prescribe(n1*(J-1)+I+1,dof%1000,0); if (J > 0) this->prescribe(n1*(J-1)+I+1,dof/1000,0);
if (J < n2-1) this->prescribe(n1*(J+1)+I+1,dof%1000,0); if (J < n2-1) this->prescribe(n1*(J+1)+I+1,dof/1000,0);
} }