Commit 1020e466 authored by daniele.corallo's avatar daniele.corallo
Browse files

[333-refactor-tcell] added testRefineMesh, communicate faces on proc-edges

parent eeb6b086
......@@ -302,6 +302,13 @@ void Mesh::Fill(const shared_ptr<CoarseGeometry> &cGeo) {
}
}
int find_other_proc(const procset& ps){
if(ps.size() != 2) THROW("Face-procset should only be on 2 processes.");
int p1 = ps->second[0];
int p2 = ps->second[1];
return p1==PPM->Proc()? p2: p1;
}
std::unique_ptr<Mesh> Mesh::Refine() const {
dout(1) << "Refine Regular" << endl;
......@@ -332,6 +339,27 @@ std::unique_ptr<Mesh> Mesh::Refine() const {
}
}
refinedMesh->Finish();
ExchangeBuffer buffer;
for (cell fine_child = refinedMesh->cells(); fine_child != refinedMesh->cells_end(); ++fine_child) {
BFParts bnd(*refinedMesh, fine_child);
for (int fid = 0; fid < fine_child.Faces(); fid++) {
face fine_face = refinedMesh->find_face(fine_child.Face(fid));
if(fine_face.Right() == Infty && bnd[fid] == -1){
procset ps = refinedMesh->find_procset(fine_face());
int other_process = find_other_proc(ps);
buffer.Send(other_process) << fine_face() << fine_face.Left();
}
}
}
buffer.Communicate();
for (int q = 0; q < PPM->size(); ++q) {
while (buffer.Receive(q).size() < buffer.ReceiveSize(q)) {
Point fine_face, fine_face_right;
buffer.Receive(q) >> fine_face >> fine_face_right;
refinedMesh->InsertFace(fine_face, fine_face_right);
}
}
return refinedMesh;
}
......
......@@ -10,6 +10,6 @@ add_mpi_test(distribution/TestDistribution LIB_MESH)
add_mpi_test(mesh/TestMeshesCreator LIB_MESH)
add_mpi_test(meshparts/TestProcSets LIB_MESH)
add_mpi_test(mesh/TestMeshesPrintInfo LIB_MESH)
#add_mpi_test(mesh/TestRefineMesh LIB_MESH)
add_mpi_test(mesh/TestRefineMesh LIB_MESH)
add_mpp_bench(BenchCellCollections LIB_MESH)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment