49 #include <Epetra_ConfigDefs.h> 52 #include <Epetra_MpiComm.h> 54 #include <Epetra_SerialComm.h> 66 #include <lifev/core/LifeV.hpp> 68 #include <lifev/core/mesh/MeshPartitioner.hpp> 69 #include <lifev/core/mesh/RegionMesh3DStructured.hpp> 70 #include <lifev/core/mesh/RegionMesh.hpp> 72 #include <lifev/core/array/MatrixEpetra.hpp> 80 #include <lifev/eta/fem/ETFESpace.hpp> 89 #include <lifev/eta/expression/Integrate.hpp> 97 #include <boost/shared_ptr.hpp> 105 using namespace LifeV;
118 int main (
int argc,
char** argv )
122 MPI_Init (&argc, &argv);
123 std::shared_ptr<Epetra_Comm> Comm (
new Epetra_MpiComm (MPI_COMM_WORLD) );
125 std::shared_ptr<Epetra_Comm> Comm (
new Epetra_SerialComm);
128 const bool verbose (Comm->MyPID() == 0);
140 std::cout <<
" -- Building and partitioning the mesh ... " << std::flush;
143 const UInt Nelements (10);
145 std::shared_ptr< mesh_Type > fullMeshPtr (
new mesh_Type ( Comm ) );
147 regularMesh3D ( *fullMeshPtr, 1, Nelements, Nelements, Nelements,
false,
151 std::shared_ptr< mesh_Type > meshPtr;
153 MeshPartitioner< mesh_Type > meshPart (fullMeshPtr, Comm);
154 meshPtr = meshPart.meshPartition();
161 std::cout <<
" done ! " << std::endl;
180 std::cout <<
" -- Building ETFESpaces ... " << std::flush;
183 std::shared_ptr<ETFESpace< mesh_Type, MapEpetra, 3, 1 > > uSpace
184 (
new ETFESpace< mesh_Type, MapEpetra, 3, 1 > (meshPtr, &feTetraP1, Comm) );
188 std::cout <<
" done ! " << std::endl;
192 std::cout <<
" ---> Dofs: " << uSpace->dof().numTotalDof() << std::endl;
202 std::cout <<
" -- Defining the matrix ... " << std::flush;
205 std::shared_ptr<matrix_Type> systemMatrix (
new matrix_Type ( uSpace->map() ) );
207 *systemMatrix *= 0.0;
211 std::cout <<
" done! " << std::endl;
214 *systemMatrix *= 0.0;
218 std::cout <<
" done! " << std::endl;
228 std::cout <<
" -- Assembling the Laplace matrix ... " << std::flush;
241 using namespace ExpressionAssembly;
274 integrate ( elements (uSpace->mesh() ),
278 dot ( grad (phi_i) , grad (phi_j) )
285 std::cout <<
" done! " << std::endl;
297 std::cout <<
" -- Closing the matrix ... " << std::flush;
300 systemMatrix->globalAssemble();
304 std::cout <<
" done ! " << std::endl;
313 Real matrixNorm ( systemMatrix->normInf() );
317 std::cout <<
" Matrix norm : " << matrixNorm << std::endl;
334 Real matrixNormDiff (std::abs (matrixNorm - 3.2) );
338 std::cout <<
" Error : " << matrixNormDiff << std::endl;
343 std::cout <<
" Error : " << matrixNormDiff << std::endl;
346 Real testTolerance (1e-10);
348 if ( matrixNormDiff < testTolerance )
350 return ( EXIT_SUCCESS );
352 return ( EXIT_FAILURE );
int main(int argc, char **argv)
MatrixEpetra< Real > matrix_Type
double Real
Generic real data.
RegionMesh< LinearTetra > mesh_Type