Loading src/TNL/Meshes/DistributedMeshes/DistributedGridIO_MeshFunction.h +6 −3 Original line number Diff line number Diff line Loading @@ -57,7 +57,8 @@ class DistributedGridIO<Functions::MeshFunction<MeshType>,LocalCopy,Device> newMesh->setOrigin(origin+TNL::Containers::Scale(spaceSteps,localBegin)); File meshFile; meshFile.open( fileName+String("-mesh-")+distrGrid->printProcessCoords()+String(".tnl"),IOMode::write); bool ok=meshFile.open( fileName+String("-mesh-")+distrGrid->printProcessCoords()+String(".tnl"),IOMode::write); TNL_ASSERT_TRUE(ok,"Not able to open mesh file to write"); newMesh->save( meshFile ); meshFile.close(); Loading @@ -72,7 +73,8 @@ class DistributedGridIO<Functions::MeshFunction<MeshType>,LocalCopy,Device> CopyEntitiesHelper<MeshFunctionType>::Copy(meshFunction,newMeshFunction,localBegin,zeroCoord,localSize); File file; file.open( fileName+String("-")+distrGrid->printProcessCoords()+String(".tnl"), IOMode::write ); ok=file.open( fileName+String("-")+distrGrid->printProcessCoords()+String(".tnl"), IOMode::write ); TNL_ASSERT_TRUE(ok,"Not able to open file to write"); bool ret=newMeshFunction.save(file); file.close(); Loading Loading @@ -110,7 +112,8 @@ class DistributedGridIO<Functions::MeshFunction<MeshType>,LocalCopy,Device> zeroCoord.setValue(0); File file; file.open( fileName+String("-")+distrGrid->printProcessCoords()+String(".tnl"), IOMode::read ); bool ok=file.open( fileName+String("-")+distrGrid->printProcessCoords()+String(".tnl"), IOMode::read ); TNL_ASSERT_TRUE(ok,"Not able to open file to read"); bool result=newMeshFunction.boundLoad(file); file.close(); CopyEntitiesHelper<MeshFunctionType>::Copy(newMeshFunction,meshFunction,zeroCoord,localBegin,localSize); Loading src/UnitTests/Meshes/DistributedMeshes/DistributedGridIOTest.h +17 −7 Original line number Diff line number Diff line Loading @@ -244,8 +244,8 @@ class TestDistributedGridIO linearFunctionEvaluator.evaluateAllEntities(meshFunctionptr , linearFunctionPtr); String FileName=String("/tmp/test-file.tnl"); DistributedGridIO<MeshFunctionType> ::save(FileName, *meshFunctionptr ); String fileName=String("test-file-distriburtegrid-io-save.tnl"); DistributedGridIO<MeshFunctionType> ::save(fileName, *meshFunctionptr ); //create similar local mesh function and evaluate linear function on it Loading Loading @@ -273,8 +273,10 @@ class TestDistributedGridIO loadDof.setValue(-1); String localFileName= fileName+String("-")+distributedGrid.printProcessCoords()+String(".tnl"); File file; file.open( FileName+String("-")+distributedGrid.printProcessCoords(), IOMode::read ); file.open(localFileName, IOMode::read ); loadMeshFunctionptr->boundLoad(file); file.close(); Loading @@ -282,6 +284,11 @@ class TestDistributedGridIO { EXPECT_EQ( localDof.getElement(i), loadDof.getElement(i)) << "Compare Loaded and evaluated Dof Failed for: "<< i; } EXPECT_EQ( std::remove( localFileName.getString()) , 0 ); //remove meshfile EXPECT_EQ( std::remove( (fileName+String("-mesh-")+distributedGrid.printProcessCoords()+String(".tnl")).getString()) , 0 ); } static void TestLoad() Loading Loading @@ -326,9 +333,10 @@ class TestDistributedGridIO linearFunctionEvaluator.evaluateAllEntities(localMeshFunctionptr , linearFunctionPtr); String FileName=String("/tmp/test-file.tnl"); String fileName=String("test-file-distributedgrid-io-load.tnl"); String localFileName=fileName+String("-")+distributedGrid.printProcessCoords()+String(".tnl"); File file; file.open( FileName+String("-")+distributedGrid.printProcessCoords(), IOMode::write ); file.open( localFileName, IOMode::write ); localMeshFunctionptr->save(file); file.close(); Loading @@ -343,7 +351,7 @@ class TestDistributedGridIO loadDof.setValue(0); loadMeshFunctionptr->bind(loadGridptr,loadDof); DistributedGridIO<MeshFunctionType> ::load(FileName, *loadMeshFunctionptr ); DistributedGridIO<MeshFunctionType> ::load(fileName, *loadMeshFunctionptr ); loadMeshFunctionptr->template synchronize<CommunicatorType>(); //need synchronization for overlaps to be filled corectly in loadDof Loading @@ -364,6 +372,8 @@ class TestDistributedGridIO { EXPECT_EQ( dof.getElement(i), loadDof.getElement(i)) << "Compare Loaded and evaluated Dof Failed for: "<< i; } EXPECT_EQ( std::remove( localFileName.getString()) , 0 ); } }; Loading
src/TNL/Meshes/DistributedMeshes/DistributedGridIO_MeshFunction.h +6 −3 Original line number Diff line number Diff line Loading @@ -57,7 +57,8 @@ class DistributedGridIO<Functions::MeshFunction<MeshType>,LocalCopy,Device> newMesh->setOrigin(origin+TNL::Containers::Scale(spaceSteps,localBegin)); File meshFile; meshFile.open( fileName+String("-mesh-")+distrGrid->printProcessCoords()+String(".tnl"),IOMode::write); bool ok=meshFile.open( fileName+String("-mesh-")+distrGrid->printProcessCoords()+String(".tnl"),IOMode::write); TNL_ASSERT_TRUE(ok,"Not able to open mesh file to write"); newMesh->save( meshFile ); meshFile.close(); Loading @@ -72,7 +73,8 @@ class DistributedGridIO<Functions::MeshFunction<MeshType>,LocalCopy,Device> CopyEntitiesHelper<MeshFunctionType>::Copy(meshFunction,newMeshFunction,localBegin,zeroCoord,localSize); File file; file.open( fileName+String("-")+distrGrid->printProcessCoords()+String(".tnl"), IOMode::write ); ok=file.open( fileName+String("-")+distrGrid->printProcessCoords()+String(".tnl"), IOMode::write ); TNL_ASSERT_TRUE(ok,"Not able to open file to write"); bool ret=newMeshFunction.save(file); file.close(); Loading Loading @@ -110,7 +112,8 @@ class DistributedGridIO<Functions::MeshFunction<MeshType>,LocalCopy,Device> zeroCoord.setValue(0); File file; file.open( fileName+String("-")+distrGrid->printProcessCoords()+String(".tnl"), IOMode::read ); bool ok=file.open( fileName+String("-")+distrGrid->printProcessCoords()+String(".tnl"), IOMode::read ); TNL_ASSERT_TRUE(ok,"Not able to open file to read"); bool result=newMeshFunction.boundLoad(file); file.close(); CopyEntitiesHelper<MeshFunctionType>::Copy(newMeshFunction,meshFunction,zeroCoord,localBegin,localSize); Loading
src/UnitTests/Meshes/DistributedMeshes/DistributedGridIOTest.h +17 −7 Original line number Diff line number Diff line Loading @@ -244,8 +244,8 @@ class TestDistributedGridIO linearFunctionEvaluator.evaluateAllEntities(meshFunctionptr , linearFunctionPtr); String FileName=String("/tmp/test-file.tnl"); DistributedGridIO<MeshFunctionType> ::save(FileName, *meshFunctionptr ); String fileName=String("test-file-distriburtegrid-io-save.tnl"); DistributedGridIO<MeshFunctionType> ::save(fileName, *meshFunctionptr ); //create similar local mesh function and evaluate linear function on it Loading Loading @@ -273,8 +273,10 @@ class TestDistributedGridIO loadDof.setValue(-1); String localFileName= fileName+String("-")+distributedGrid.printProcessCoords()+String(".tnl"); File file; file.open( FileName+String("-")+distributedGrid.printProcessCoords(), IOMode::read ); file.open(localFileName, IOMode::read ); loadMeshFunctionptr->boundLoad(file); file.close(); Loading @@ -282,6 +284,11 @@ class TestDistributedGridIO { EXPECT_EQ( localDof.getElement(i), loadDof.getElement(i)) << "Compare Loaded and evaluated Dof Failed for: "<< i; } EXPECT_EQ( std::remove( localFileName.getString()) , 0 ); //remove meshfile EXPECT_EQ( std::remove( (fileName+String("-mesh-")+distributedGrid.printProcessCoords()+String(".tnl")).getString()) , 0 ); } static void TestLoad() Loading Loading @@ -326,9 +333,10 @@ class TestDistributedGridIO linearFunctionEvaluator.evaluateAllEntities(localMeshFunctionptr , linearFunctionPtr); String FileName=String("/tmp/test-file.tnl"); String fileName=String("test-file-distributedgrid-io-load.tnl"); String localFileName=fileName+String("-")+distributedGrid.printProcessCoords()+String(".tnl"); File file; file.open( FileName+String("-")+distributedGrid.printProcessCoords(), IOMode::write ); file.open( localFileName, IOMode::write ); localMeshFunctionptr->save(file); file.close(); Loading @@ -343,7 +351,7 @@ class TestDistributedGridIO loadDof.setValue(0); loadMeshFunctionptr->bind(loadGridptr,loadDof); DistributedGridIO<MeshFunctionType> ::load(FileName, *loadMeshFunctionptr ); DistributedGridIO<MeshFunctionType> ::load(fileName, *loadMeshFunctionptr ); loadMeshFunctionptr->template synchronize<CommunicatorType>(); //need synchronization for overlaps to be filled corectly in loadDof Loading @@ -364,6 +372,8 @@ class TestDistributedGridIO { EXPECT_EQ( dof.getElement(i), loadDof.getElement(i)) << "Compare Loaded and evaluated Dof Failed for: "<< i; } EXPECT_EQ( std::remove( localFileName.getString()) , 0 ); } };