37 #include <lifev/core/LifeV.hpp> 38 #include <lifev/core/array/GhostHandler.hpp> 39 #include <lifev/core/array/VectorEpetra.hpp> 40 #include <lifev/core/mesh/MeshData.hpp> 41 #include <lifev/core/mesh/MeshPartitioner.hpp> 42 #include <lifev/core/filter/GetPot.hpp> 44 #include <lifev/core/filter/Exporter.hpp> 46 #include <lifev/core/filter/ExporterHDF5.hpp> 49 using namespace LifeV;
52 int main (
int argc,
char* argv[] )
54 std::shared_ptr<Epetra_Comm> Comm;
56 MPI_Init (&argc, &argv);
57 Comm.reset (
new Epetra_MpiComm (MPI_COMM_WORLD) );
59 comm.reset (
new Epetra_SerialComm() );
66 typedef RegionMesh < geoElement_Type > mesh_Type;
67 typedef std::shared_ptr < mesh_Type > meshPtr_Type;
69 typedef std::shared_ptr<vector_Type> vectorPtr_Type;
72 meshData.setup (dataFile,
"space_discretization");
74 meshPtr_Type fullMeshPtr (
new mesh_Type ( Comm ) );
75 readMesh (*fullMeshPtr, meshData);
78 meshPtr_Type localMeshPtr;
82 meshPart.setPartitionOverlap (levelOverlap);
83 meshPart.doPartition (fullMeshPtr, Comm);
84 localMeshPtr = meshPart.meshPartition();
87 std::shared_ptr<FESpace<mesh_Type, MapEpetra> > FESpaceP1 (
new FESpace<mesh_Type, MapEpetra> (localMeshPtr,
"P1", 1, Comm) );
88 GhostHandler<mesh_Type> ghostObj ( fullMeshPtr, localMeshPtr, FESpaceP1->mapPtr(), Comm );
89 ghostObj.setUpNeighbors();
121 Neighbors = ghostObj.circleNeighbors ( fullMeshPtr->point (ID_trial).id(), nc );
122 Neighbors.insert (fullMeshPtr->point (ID_trial).id() );
129 vectorPtr_Type TrialOutput (
new vector_Type (FESpaceP1->map(), Unique) );
131 for (neighbors_Type::iterator ii = Neighbors.begin(); ii != Neighbors.end(); ++ii)
132 if (TrialOutput->blockMap().LID (
static_cast<
int> (*ii) ) != -1)
136 (*TrialOutput) [*ii] = -1;
140 (*TrialOutput) [*ii] = 1;
144 ExporterHDF5<mesh_Type> exporter (dataFile, localMeshPtr,
"Output_test_neighborsCircle", Comm->MyPID() );
145 exporter.setMeshProcId (localMeshPtr, Comm->MyPID() );
146 exporter.exportPID (localMeshPtr, Comm,
true );
147 exporter.addVariable (ExporterData<mesh_Type>::ScalarField,
"Neighbors, red color", FESpaceP1, TrialOutput, UInt (0) );
148 exporter.postProcess (0);
149 exporter.closeFile();
VectorEpetra - The Epetra Vector format Wrapper.
GetPot(const int argc_, char **argv_, const char *FieldSeparator=0x0)
std::shared_ptr< std::vector< Int > > M_isOnProc
MeshData - class for handling spatial discretization.
std::unordered_set< ID > neighbors_Type
GetPot(const STRING_VECTOR &FileNameList)
const std::string follow(const char *Default, unsigned No, const char *Option,...)
int main(int argc, char **argv)
void importFromHDF5(std::string const &fileName="ghostmap")
Import neighbor lists to an hdf5 file.
uint32_type UInt
generic unsigned integer (used mainly for addressing)