40 #include <lifev/core/LifeV.hpp> 45 #include "Epetra_config.h" 47 #ifndef LIFEV_HAS_HDF5 49 #warning warning you should reconfigure LifeV with -D TPL_ENABLE_HDF5:BOOL=ON 55 #warning warning you should reconfigure LifeV with -D TPL_ENABLE_MPI:BOOL=ON 60 #pragma GCC diagnostic ignored "-Wunused-variable" 61 #pragma GCC diagnostic ignored "-Wunused-parameter" 65 #include <Epetra_MpiComm.h> 68 #pragma GCC diagnostic warning "-Wunused-variable" 69 #pragma GCC diagnostic warning "-Wunused-parameter" 71 #include <lifev/core/mesh/MeshPartitioner.hpp> 72 #include <lifev/core/filter/PartitionIO.hpp> 73 #include <lifev/core/mesh/MeshData.hpp> 74 #include <lifev/core/mesh/RegionMesh.hpp> 76 using namespace LifeV;
81 int main (
int argc,
char** argv)
86 typedef RegionMesh<LinearTetra> mesh_Type;
88 MPI_Init (&argc, &argv);
89 std::shared_ptr<Epetra_Comm> comm (
new Epetra_MpiComm (MPI_COMM_WORLD) );
91 if (comm->NumProc() != 1)
93 std::cout <<
"This test needs to be run " 94 <<
"with a single process. Aborting." 96 return (EXIT_FAILURE);
99 GetPot commandLine (argc, argv);
100 std::string dataFileName = commandLine.follow (
"data", 2,
"-f",
"--file");
101 GetPot dataFile (dataFileName);
103 const UInt numParts (dataFile (
"offlinePartition/num_parts", 4) );
104 std::string stringFileName (dataFile (
"offlinePartition/nameFile",
"NO_DEFAULT_VALE") );
106 stringFileName +=
"Partitioned.h5";
108 std::cout <<
"Number of parts: " << numParts << std::endl;
109 std::cout <<
"Name of HDF5 container: " << stringFileName << std::endl;
113 meshData.setup (dataFile,
"solid/space_discretization");
116 std::shared_ptr<mesh_Type> fullMeshPtr (
new mesh_Type ( comm ) );
117 readMesh (*fullMeshPtr, meshData);
119 fullMeshPtr->showMe();
122 MeshPartitioner<mesh_Type> meshPart;
123 meshPart.setup (numParts, comm);
125 meshPart.attachUnpartitionedMesh (fullMeshPtr);
126 meshPart.doPartitionGraph();
127 meshPart.doPartitionMesh();
131 meshPart.releaseUnpartitionedMesh();
136 std::shared_ptr<Epetra_MpiComm> mpiComm =
137 std::dynamic_pointer_cast<Epetra_MpiComm> (comm);
138 PartitionIO<mesh_Type> partitionIO (stringFileName, mpiComm);
140 partitionIO.write (meshPart.meshPartitions() );
145 std::cout <<
"This test needs MPI to run. Aborting." << std::endl;
146 return (EXIT_FAILURE);
149 std::cout <<
"This test needs HDF5 enabled in LifeV to run. Aborting." << std::endl;
150 return (EXIT_FAILURE);
153 return (EXIT_SUCCESS);
int main(int argc, char **argv)