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;
51 int main (
int argc,
char* argv[] )
55 typedef RegionMesh < geoElement_Type > mesh_Type;
56 typedef std::shared_ptr < mesh_Type > meshPtr_Type;
58 typedef std::shared_ptr<vector_Type> vectorPtr_Type;
60 std::shared_ptr<Epetra_Comm> Comm;
62 MPI_Init (&argc, &argv);
63 Comm.reset (
new Epetra_MpiComm (MPI_COMM_WORLD) );
65 comm.reset (
new Epetra_SerialComm() );
74 meshData.setup (dataFile,
"space_discretization");
76 meshPtr_Type fullMeshPtr (
new mesh_Type ( Comm ) );
77 readMesh (*fullMeshPtr, meshData);
81 meshPtr_Type localMeshPtr;
85 meshPart.setPartitionOverlap (levelOverlap);
86 meshPart.doPartition (fullMeshPtr, Comm);
87 localMeshPtr = meshPart.meshPartition();
90 std::shared_ptr<FESpace<mesh_Type, MapEpetra> > FESpaceP1 (
new FESpace<mesh_Type, MapEpetra> (localMeshPtr,
"P1", 1, Comm) );
91 GhostHandler<mesh_Type> ghostObj ( fullMeshPtr, localMeshPtr, FESpaceP1->mapPtr(), Comm );
94 std::vector<
int> interfaceMarkers (2);
95 interfaceMarkers[0] = 20;
96 interfaceMarkers[1] = 1;
97 ghostObj.createPointPointNeighborsList ( interfaceMarkers );
101 double radius = 4 * (
double) MeshUtility::MeshStatistics::computeSize (*fullMeshPtr).maxH;
103 Neighbors = ghostObj.neighborsWithinRadius ( fullMeshPtr->point (ID_trial).id(), radius );
104 Neighbors.insert (fullMeshPtr->point (ID_trial).id() );
107 vectorPtr_Type TrialOutput (
new vector_Type (FESpaceP1->map(), Unique) );
109 for (neighbors_Type::iterator ii = Neighbors.begin(); ii != Neighbors.end(); ++ii)
110 if (TrialOutput->blockMap().LID (
static_cast<
int> (*ii) ) != -1)
114 (*TrialOutput) [*ii] = -1;
118 (*TrialOutput) [*ii] = 1;
122 ExporterHDF5<mesh_Type> exporter (dataFile, localMeshPtr,
"Output_test_neighborsRadius", Comm->MyPID() );
123 exporter.setMeshProcId (localMeshPtr, Comm->MyPID() );
124 exporter.exportPID (localMeshPtr, Comm,
true );
125 exporter.addVariable (ExporterData<mesh_Type>::ScalarField,
"Neighbors, red color", FESpaceP1, TrialOutput, UInt (0) );
126 exporter.postProcess (0);
127 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)