Skip to content

Commit d77abd1

Browse files
committed
moved test all
1 parent b12ed17 commit d77abd1

2 files changed

Lines changed: 21 additions & 19 deletions

File tree

src/pumipic_adaptation.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ namespace Omega_h {
9595
const int rotateDirCode[3][2] = {{0,1},{0,0},{1,0}};
9696
int rotated = rotateDirCode[side][modified[oldElem].rotation];
9797
auto prod = keys2prods[key] + modified[oldElem].offset*2 + rotated;
98-
// ptclElem(pid) = prods2new_ents[prod];
98+
ptclElem(pid) = prods2new_ents[prod];
9999
ptclDim(pid) = mesh_dim;
100100

101101
//case 1: elem on new ptcl
@@ -112,11 +112,11 @@ namespace Omega_h {
112112
return; //go to next ptcl
113113
}
114114
//case 3: elem on new edge
115-
// if (side == 1) {
116-
// auto edgeIdx = ptclElem(pid)*nEdges + modified[oldElem].rotation + side;
117-
// ptclChild(pid) = edgeIdx;
118-
// ptclDim(pid) = 1;
119-
// }
115+
if (side == 1) {
116+
auto edgeIdx = ptclElem(pid)*nEdges + modified[oldElem].rotation + side;
117+
ptclChild(pid) = edgeIdx;
118+
ptclDim(pid) = 1;
119+
}
120120
// case 4: elem on old edge
121121
}
122122
else {

test/particle_adapt.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ int compareWithSearch(Omega_h::Mesh& mesh, PS*& ptcls) {
137137
}
138138

139139
template<int dim>
140-
bool testVert2Vert(Omega_h::Mesh& mesh)
140+
int testVert2Vert(Omega_h::Mesh& mesh)
141141
{
142142
printf("==Test: Migrate ptcl from vertex to vertex==\n");
143143
PS* ptcls = createPtclStructure(mesh, 1);
@@ -148,18 +148,10 @@ bool testVert2Vert(Omega_h::Mesh& mesh)
148148
return fails;
149149
}
150150

151-
int main(int argc, char* argv[]) {
152-
auto lib = Omega_h::Library(&argc, &argv);
153-
auto world = lib.world();
154-
auto mesh = Omega_h::build_box(world, OMEGA_H_SIMPLEX, 1, 1, 1, 2, 2, 0, false);
155-
Omega_h::vtk::write_vtu("box_before_adapt.vtu", &mesh);
156-
const int dim = 2;
157-
158-
// Initalize Particles
151+
template<int dim>
152+
int testAll(Omega_h::Mesh& mesh)
153+
{
159154
PS* ptcls = createPtclStructure(mesh, 3);
160-
161-
// Set Particle Info
162-
163155
auto cells2nodes = mesh.get_adj(dim, Omega_h::VERT).ab2b;
164156
auto nodes2coords = mesh.coords();
165157
auto ptclPos = ptcls->get<POS>();
@@ -187,7 +179,17 @@ int main(int argc, char* argv[]) {
187179
adaptMesh<dim>(mesh, ptcls, {.75});
188180
int fails = migratePtclsAfterAdapt(mesh, ptcls);
189181
fails += compareWithSearch<dim>(mesh, ptcls);
190-
191182
delete ptcls;
192183
return fails;
184+
}
185+
186+
int main(int argc, char* argv[]) {
187+
auto lib = Omega_h::Library(&argc, &argv);
188+
auto world = lib.world();
189+
auto mesh = Omega_h::build_box(world, OMEGA_H_SIMPLEX, 1, 1, 1, 2, 2, 0, false);
190+
Omega_h::vtk::write_vtu("box_before_adapt.vtu", &mesh);
191+
const int dim = 2;
192+
193+
int fails = testAll<dim>(mesh);
194+
return fails;
193195
}

0 commit comments

Comments
 (0)