fixed: periodic single patch models with multiple bases

This commit is contained in:
Arne Morten Kvarving 2022-10-03 10:53:18 +02:00
parent d748bdc0eb
commit cfa6a8b4a2
2 changed files with 11 additions and 8 deletions

View File

@ -718,18 +718,19 @@ void ASMs2D::closeBoundaries (int dir, int basis, int master)
int n1, n2; int n1, n2;
if (!this->getSize(n1,n2,basis)) return; if (!this->getSize(n1,n2,basis)) return;
int dirs = utl::getDirs(this->getNoFields(basis));
switch (dir) switch (dir)
{ {
case 1: // Edges are closed in I-direction case 1: // Edges are closed in I-direction
for (int i2 = 1; i2 <= n2; i2++, master += n1) for (int i2 = 1; i2 <= n2; i2++, master += n1)
this->makePeriodic(master,master+n1-1); this->makePeriodic(master,master+n1-1,dirs);
threadGroups.stripDir = ThreadGroups::U; threadGroups.stripDir = ThreadGroups::U;
break; break;
case 2: // Edges are closed in J-direction case 2: // Edges are closed in J-direction
for (int i1 = 1; i1 <= n1; i1++, master++) for (int i1 = 1; i1 <= n1; i1++, master++)
this->makePeriodic(master,master+n1*(n2-1)); this->makePeriodic(master,master+n1*(n2-1),dirs);
threadGroups.stripDir = ThreadGroups::V; threadGroups.stripDir = ThreadGroups::V;
break; break;
} }

View File

@ -784,26 +784,28 @@ void ASMs3D::closeBoundaries (int dir, int basis, int master)
int n1, n2, n3; int n1, n2, n3;
if (!this->getSize(n1,n2,n3,basis)) return; if (!this->getSize(n1,n2,n3,basis)) return;
int dirs = utl::getDirs(this->getNoFields(basis));
switch (dir) switch (dir)
{ {
case 1: // Faces are closed in I-direction case 1: // Faces are closed in I-direction
for (int i3 = 1; i3 <= n3; i3++) for (int i3 = 1; i3 <= n3; i3++)
for (int i2 = 1; i2 <= n2; i2++, master += n1) for (int i2 = 1; i2 <= n2; i2++, master += n1)
this->makePeriodic(master,master+n1-1); this->makePeriodic(master,master+n1-1,dirs);
threadGroupsVol.stripDir = ThreadGroups::U; threadGroupsVol.stripDir = ThreadGroups::U;
break; break;
case 2: // Faces are closed in J-direction case 2: // Faces are closed in J-direction
for (int i3 = 1; i3 <= n3; i3++, master += n1*(n2-1)) for (int i3 = 1; i3 <= n3; i3++, master += n1*(n2-1))
for (int i1 = 1; i1 <= n1; i1++, master++) for (int i1 = 1; i1 <= n1; i1++, master++)
this->makePeriodic(master,master+n1*(n2-1)); this->makePeriodic(master,master+n1*(n2-1),dirs);
threadGroupsVol.stripDir = ThreadGroups::V; threadGroupsVol.stripDir = ThreadGroups::V;
break; break;
case 3: // Faces are closed in K-direction case 3: // Faces are closed in K-direction
for (int i2 = 1; i2 <= n2; i2++) for (int i2 = 1; i2 <= n2; i2++)
for (int i1 = 1; i1 <= n1; i1++, master++) for (int i1 = 1; i1 <= n1; i1++, master++)
this->makePeriodic(master,master+n1*n2*(n3-1)); this->makePeriodic(master,master+n1*n2*(n3-1),dirs);
threadGroupsVol.stripDir = ThreadGroups::W; threadGroupsVol.stripDir = ThreadGroups::W;
break; break;
} }