Skip to content

Commit 90c6727

Browse files
committed
fixed findEnclosing for high-order meshes
1 parent d176349 commit 90c6727

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

examples/interp/interp.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@
5454
fine.refine(refine)
5555
fine.balance(1)
5656
fine.repartition()
57-
fine.setMeshOrder(2, TMR.GAUSS_LOBATTO_POINTS)
57+
fine.setMeshOrder(4, TMR.GAUSS_LOBATTO_POINTS)
5858
fine.createNodes()
59-
fine.writeForestToVTK('fine_forest%d.vtk'%(comm.rank))
6059

6160
# Create a refinement array
6261
octants = fine.getOctants()
@@ -74,7 +73,6 @@
7473
coarse.repartition()
7574
coarse.setMeshOrder(2, TMR.GAUSS_LOBATTO_POINTS)
7675
coarse.createNodes()
77-
coarse.writeForestToVTK('coarse_forest%d.vtk'%(comm.rank))
7876

7977
coarse_range = coarse.getNodeRange()
8078
nc = coarse_range[comm.rank+1] - coarse_range[comm.rank]

src/TMROctForest.cpp

+7-9
Original file line numberDiff line numberDiff line change
@@ -6079,32 +6079,30 @@ TMROctant* TMROctForest::findEnclosing( const int order,
60796079
// exactly along a coordinate line. These will take precidence over
60806080
// the real value parametric locations since comparisons will be
60816081
// exact.
6082-
int32_t xi = -1;
6082+
int32_t xi = -1, yi = -1, zi = -1;
60836083
if (ii == 0 || ii == order-1){
6084-
xi = node->x + ii*h;
6084+
xi = node->x + (ii/(order-1))*h;
60856085
}
60866086
else if (order % 2 == 1 && ii == order/2){
60876087
xi = node->x + h/2;
60886088
}
6089-
int32_t yi = -1;
60906089
if (jj == 0 || jj == order-1){
6091-
yi = node->y + jj*h;
6090+
yi = node->y + (jj/(order-1))*h;
60926091
}
60936092
else if (order % 2 == 1 && jj == order/2){
60946093
yi = node->y + h/2;
60956094
}
6096-
int32_t zi = -1;
60976095
if (kk == 0 || kk == order-1){
6098-
zi = node->z + ii*h;
6096+
zi = node->z + (kk/(order-1))*h;
60996097
}
61006098
else if (order % 2 == 1 && kk == order/2){
61016099
zi = node->z + h/2;
61026100
}
61036101

61046102
// Compute the real value parametric node location on this block
6105-
double xd = node->x + 0.5*h*(1.0 + knots[ii]);
6106-
double yd = node->y + 0.5*h*(1.0 + knots[jj]);
6107-
double zd = node->z + 0.5*h*(1.0 + knots[kk]);
6103+
const double xd = node->x + 0.5*h*(1.0 + knots[ii]);
6104+
const double yd = node->y + 0.5*h*(1.0 + knots[jj]);
6105+
const double zd = node->z + 0.5*h*(1.0 + knots[kk]);
61086106

61096107
// Set the low and high indices to the first and last element of the
61106108
// element array

src/TMRQuadForest.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -4103,16 +4103,15 @@ TMRQuadrant* TMRQuadForest::findEnclosing( const int order,
41034103
// exactly along a coordinate line. These will take precidence over
41044104
// the real value parametric locations since comparisons will be
41054105
// exact.
4106-
int32_t xi = -1;
4106+
int32_t xi = -1, yi = -1;
41074107
if (ii == 0 || ii == order-1){
4108-
xi = node->x + ii*h;
4108+
xi = node->x + (ii/(order-1))*h;
41094109
}
41104110
else if (order % 2 == 1 && ii == order/2){
41114111
xi = node->x + h/2;
41124112
}
4113-
int32_t yi = -1;
41144113
if (jj == 0 || jj == order-1){
4115-
yi = node->y + jj*h;
4114+
yi = node->y + (jj/(order-1))*h;
41164115
}
41174116
else if (order % 2 == 1 && jj == order/2){
41184117
yi = node->y + h/2;

0 commit comments

Comments
 (0)