Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
......@@ -23,8 +23,8 @@
using namespace TNL;
using namespace TNL::Containers;
using namespace TNL::Arithmetics;
using namespace TNL::Containers::Algorithms;
using namespace TNL::Arithmetics;
// should be small enough to have fast tests, but larger than minGPUReductionDataSize
// and large enough to require multiple CUDA blocks for reduction
......
......@@ -578,7 +578,7 @@ TEST(CutDistributedMeshFunction, 3D_2_Save)
StaticVector<1,typename CutMeshType::IndexType>(4) );
String FileName=String("/tmp/test-file.tnl");
String FileName=String("test-file.tnl");
if(inCut)
{
MeshFunction<CutMeshType> cutMeshFunction;
......@@ -612,7 +612,8 @@ TEST(CutDistributedMeshFunction, 3D_2_Save)
loadMeshFunctionptr.bind(globalCutGrid,loaddof);
File file;
file.open( FileName, IOMode::read );
bool ok=file.open( FileName, IOMode::read );
TNL_ASSERT_TRUE(ok,"Cannot open file");
loadMeshFunctionptr.boundLoad(file);
file.close();
......@@ -630,9 +631,12 @@ TEST(CutDistributedMeshFunction, 3D_2_Save)
fromEntity.refresh();
outEntity.refresh();
EXPECT_EQ(loadMeshFunctionptr.getValue(outEntity), (*linearFunctionPtr)(fromEntity)) << "Error in Left overlap";
EXPECT_EQ(loadMeshFunctionptr.getValue(outEntity), (*linearFunctionPtr)(fromEntity)) << "Error at "<< i <<" "<< j;
}
EXPECT_EQ( std::remove( FileName.getString()) , 0 );
EXPECT_EQ( std::remove( (FileName+String("-mesh.tnl")).getString()) , 0 );
}
}
......
......@@ -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
......@@ -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();
......@@ -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()
......@@ -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();
......@@ -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
......@@ -363,7 +371,9 @@ class TestDistributedGridIO
for(int i=0;i<dof.getSize();i++)
{
EXPECT_EQ( dof.getElement(i), loadDof.getElement(i)) << "Compare Loaded and evaluated Dof Failed for: "<< i;
}
}
EXPECT_EQ( std::remove( localFileName.getString()) , 0 );
}
};
......@@ -80,7 +80,7 @@ class TestDistributedGridMPIIO{
linearFunctionEvaluator.evaluateAllEntities(meshFunctionptr , linearFunctionPtr);
String FileName=String("/tmp/test-file.tnl");
String FileName=String("test-file-mpiio-save.tnl");
DistributedGridIO<MeshFunctionType,MpiIO> ::save(FileName, *meshFunctionptr );
//first process compare results
......@@ -108,6 +108,7 @@ class TestDistributedGridMPIIO{
{
EXPECT_EQ( globalEvaluatedDof.getElement(i), loadDof.getElement(i)) << "Compare Loaded and evaluated Dof Failed for: "<< i;
}
EXPECT_EQ( std::remove( FileName.getString()) , 0 );
}
}
......@@ -135,7 +136,7 @@ class TestDistributedGridMPIIO{
SubdomainOverlapsGetter< MeshType, CommunicatorType >::getOverlaps( &distributedGrid, lowerOverlap, upperOverlap, 1 );
distributedGrid.setOverlaps( lowerOverlap, upperOverlap );
String FileName=String("/tmp/test-file.tnl");
String FileName=String("/tmp/test-file-mpiio-load.tnl");
//Prepare file
if(CommunicatorType::GetRank(CommunicatorType::AllGroup)==0)
......@@ -178,6 +179,11 @@ class TestDistributedGridMPIIO{
{
EXPECT_EQ( evalDof.getElement(i), loadDof.getElement(i)) << "Compare Loaded and evaluated Dof Failed for: "<< i;
}
if(CommunicatorType::GetRank(CommunicatorType::AllGroup)==0)
{
EXPECT_EQ( std::remove( FileName.getString()) , 0 );
}
}
};
......