void gcm::Geo2MeshLoader::loadMesh(TetrMeshSecondOrder* mesh, GCMDispatcher* dispatcher, string fileName, float tetrSize) { if (!isMshFileCreated(fileName)) createMshFile(fileName, tetrSize); //IBody* body = mesh->getBody(); Engine& engine = Engine::getInstance(); if( engine.getRank() == 0 ) { LOG_DEBUG("Worker 0 started generating second order mesh from first order msh file"); TetrMeshFirstOrder* foMesh = new TetrMeshFirstOrder(); // foMesh->setBody(body); TetrMeshSecondOrder* soMesh = new TetrMeshSecondOrder(); // soMesh->setBody(body); int sd, nn; AABB scene; GCMDispatcher* myDispatcher = new DummyDispatcher(); myDispatcher->setEngine(&Engine::getInstance()); preLoadMesh(&scene, sd, nn, fileName, tetrSize); myDispatcher->prepare(1, &scene); MshTetrFileReader* reader = new MshTetrFileReader(); reader->readFile(getMshFileName(fileName), foMesh, myDispatcher, engine.getRank(), true); soMesh->copyMesh(foMesh); soMesh->preProcess(); VTK2SnapshotWriter* sw = new VTK2SnapshotWriter(); sw->setFileName(getVtkFileName(fileName)); sw->dump(soMesh, -1); delete sw; delete reader; delete foMesh; delete soMesh; LOG_DEBUG("Worker 0 completed generating second order mesh"); } MPI::COMM_WORLD.Barrier(); LOG_DEBUG("Starting reading mesh"); Vtu2TetrFileReader* reader = new Vtu2TetrFileReader(); reader->readFile(getVtkFileName(fileName), mesh, dispatcher, engine.getRank()); delete reader; mesh->preProcess(); }
void Ani3D2MeshLoader::loadMesh(TetrMeshSecondOrder* mesh, GCMDispatcher* dispatcher, const string& fileName) { auto body = mesh->getBody(); auto& engine = Engine::getInstance(); if( engine.getRank() == 0 ) { LOG_DEBUG("Worker 0 started generating second order mesh"); TetrMeshFirstOrder* foMesh = new TetrMeshFirstOrder(); foMesh->setBody(body); TetrMeshSecondOrder* soMesh = new TetrMeshSecondOrder(); soMesh->setBody(body); int sd, nn; AABB scene; GCMDispatcher* myDispatcher = new DummyDispatcher(); preLoadMesh(&scene, sd, nn, fileName); myDispatcher->prepare(1, &scene); Ani3DTetrFileReader* reader = new Ani3DTetrFileReader(); reader->readFile(fileName, foMesh, myDispatcher, engine.getRank(), true); soMesh->copyMesh(foMesh); soMesh->preProcess(); VTK2SnapshotWriter* sw = new VTK2SnapshotWriter(); // FIXME are we really about to overwrite this file? sw->dump(soMesh, -1, getVtkFileName(fileName)); delete sw; delete reader; delete foMesh; delete soMesh; LOG_DEBUG("Worker 0 completed generating second order mesh"); } MPI::COMM_WORLD.Barrier(); LOG_DEBUG("Starting reading mesh"); Vtu2TetrFileReader* reader = new Vtu2TetrFileReader(); reader->readFile(getVtkFileName(fileName), mesh, dispatcher, engine.getRank()); delete reader; LOG_DEBUG("Deleting generated file: " << getVtkFileName(fileName)); remove( getVtkFileName(fileName).c_str() ); mesh->preProcess(); }