8 #include <Epetra_ConfigDefs.h> 9 #include <Epetra_Comm.h> 11 #include <lifev/core/LifeV.hpp> 12 #include <lifev/core/filter/GetPot.hpp> 13 #include <lifev/core/mesh/RegionMesh.hpp> 14 #include <lifev/core/mesh/MeshLoadingUtility.hpp> 16 using namespace LifeV;
19 int main (
int argc,
char** argv)
21 using namespace LifeV;
23 MPI_Init (&argc, &argv);
24 std::cout <<
"MPI Initialization\n";
28 std::shared_ptr<Epetra_Comm> comm (
new Epetra_MpiComm (MPI_COMM_WORLD) );
30 std::shared_ptr<Epetra_Comm> comm (
new Epetra_SerialComm() );
33 std::string dataFileName;
35 dataFileName = command_line
.follow ("data", 2
, "-f", "--file");
38 if ( comm -> MyPID() == 0 )
40 std::cout <<
"\n\nReading and partitioning the cube mesh without saving the global mesh: ... \n";
43 std::string meshName = dataFile
("mesh/mesh_file", "cube4x4.mesh");
44 std::string meshPath = dataFile
("mesh/mesh_dir", "./");
45 std::string meshOrder = dataFile
("mesh/mesh_order", "P1");
46 bool isPartitioned =
false;
50 std::shared_ptr< RegionMesh <LinearTetra> > meshPtr (
new RegionMesh <LinearTetra> ( comm ) );
51 MeshUtility::loadMesh ( meshPtr, meshName, meshPath, isPartitioned, meshOrder );
52 if ( comm -> MyPID() == 0 )
54 std::cout <<
"... DONE! ";
60 if ( comm -> MyPID() == 0 )
62 std::cout <<
"\n\nReading and partitioning the cube mesh saving the global mesh: ... \n";
64 std::shared_ptr< RegionMesh <LinearTetra> > meshFullPtr (
new RegionMesh <LinearTetra> ( comm ) );
65 std::shared_ptr< RegionMesh <LinearTetra> > meshLocalPtr (
new RegionMesh <LinearTetra> ( comm ) );
66 MeshUtility::loadMesh ( meshLocalPtr, meshFullPtr, meshName, meshPath, isPartitioned,
"P1" );
67 if ( comm -> MyPID() == 0 )
69 std::cout <<
"... DONE! ";
75 if ( comm -> MyPID() == 0 )
77 std::cout <<
"\n\nCreating a structured mesh without saving the full mesh: ... \n";
79 std::shared_ptr< RegionMesh <LinearTetra> > meshStructPtr (
new RegionMesh <LinearTetra> ( comm ) );
80 std::vector<Real> l (3, 1.0);
81 std::vector<Real> t (3, 0.0);
82 MeshUtility::loadStructuredMesh ( meshStructPtr,
84 std::vector<UInt> (3, 5),
90 if ( comm -> MyPID() == 0 )
92 std::cout <<
"... DONE!\n\n ";
100 std::cout <<
"MPI Finalization \n";
GetPot(const int argc_, char **argv_, const char *FieldSeparator=0x0)
const std::string operator()(const char *VarName, const char *Default) const
GetPot(const STRING_VECTOR &FileNameList)
const std::string follow(const char *Default, unsigned No, const char *Option,...)
int main(int argc, char **argv)