48 #include <Epetra_ConfigDefs.h> 51 #include <Epetra_MpiComm.h> 53 #include <Epetra_SerialComm.h> 57 #include <lifev/core/LifeV.hpp> 59 #include <lifev/core/mesh/MeshPartitioner.hpp> 60 #include <lifev/core/mesh/RegionMesh3DStructured.hpp> 61 #include <lifev/core/mesh/RegionMesh.hpp> 63 #include <lifev/core/array/MatrixEpetra.hpp> 64 #include <lifev/core/array/VectorEpetra.hpp> 66 #include <lifev/eta/fem/ETFESpace.hpp> 67 #include <lifev/eta/expression/Integrate.hpp> 69 #include <boost/shared_ptr.hpp> 71 #include <lifev/core/fem/FESpace.hpp> 72 #include <lifev/core/solver/ADRAssembler.hpp> 80 using namespace LifeV;
92 int main (
int argc,
char** argv )
96 MPI_Init (&argc, &argv);
97 std::shared_ptr<Epetra_Comm> Comm (
new Epetra_MpiComm (MPI_COMM_WORLD) );
99 std::shared_ptr<Epetra_Comm> Comm (
new Epetra_SerialComm);
102 const bool verbose (Comm->MyPID() == 0);
112 std::cout <<
" -- Building and partitioning the mesh ... " << std::flush;
115 const UInt Nelements (10);
117 std::shared_ptr< mesh_Type > fullMeshPtr (
new mesh_Type ( Comm ) );
119 regularMesh3D ( *fullMeshPtr, 1, Nelements, Nelements, Nelements,
false,
123 std::shared_ptr< mesh_Type > meshPtr;
125 MeshPartitioner< mesh_Type > meshPart (fullMeshPtr, Comm);
126 meshPtr = meshPart.meshPartition();
133 std::cout <<
" done ! " << std::endl;
151 std::cout <<
" -- Building the FESpace ... " << std::flush;
154 std::string uOrder (
"P1");
156 std::shared_ptr<FESpace< mesh_Type, MapEpetra > > uSpace
157 (
new FESpace< mesh_Type, MapEpetra > (meshPtr, uOrder, 3, Comm) );
161 std::cout <<
" done ! " << std::endl;
165 std::cout <<
" ---> Dofs: " << uSpace->dof().numTotalDof() << std::endl;
170 std::cout <<
" -- Building the ETFESpace ... " << std::flush;
173 std::shared_ptr<ETFESpace< mesh_Type, MapEpetra, 3, 3 > > ETuSpace
174 (
new ETFESpace< mesh_Type, MapEpetra, 3, 3 > (meshPtr, & (uSpace->refFE() ), & (uSpace->fe().geoMap() ), Comm) );
178 std::cout <<
" done ! " << std::endl;
182 std::cout <<
" ---> Dofs: " << ETuSpace->dof().numTotalDof() << std::endl;
196 std::cout <<
" -- Defining the matrices ... " << std::flush;
199 std::shared_ptr<matrix_Type> systemMatrix (
new matrix_Type ( uSpace->map() ) );
200 *systemMatrix *= 0.0;
202 std::shared_ptr<matrix_Type> ETsystemMatrix (
new matrix_Type ( ETuSpace->map() ) );
203 *ETsystemMatrix *= 0.0;
207 std::cout <<
" done! " << std::endl;
218 std::cout <<
" -- Classical assembly ... " << std::flush;
221 ADRAssembler<mesh_Type, matrix_Type, vector_Type> adrAssembler;
223 adrAssembler.setup (uSpace, uSpace);
225 adrAssembler.addDiffusion (systemMatrix, 1.0);
229 std::cout <<
" done ! " << std::endl;
240 std::cout <<
" -- ET assembly ... " << std::flush;
245 using namespace ExpressionAssembly;
247 integrate ( elements (ETuSpace->mesh() ),
252 dot ( grad (phi_i) , grad (phi_j) )
260 std::cout <<
" done! " << std::endl;
270 std::cout <<
" -- Closing the matrices ... " << std::flush;
273 systemMatrix->globalAssemble();
274 ETsystemMatrix->globalAssemble();
278 std::cout <<
" done ! " << std::endl;
290 std::cout <<
" -- Computing the error ... " << std::flush;
293 std::shared_ptr<matrix_Type> checkMatrix (
new matrix_Type ( ETuSpace->map() ) );
296 *checkMatrix += *systemMatrix;
297 *checkMatrix += (*ETsystemMatrix) * (-1);
299 checkMatrix->globalAssemble();
301 Real errorNorm ( checkMatrix->normInf() );
305 std::cout <<
" done ! " << std::endl;
325 std::cout <<
" Matrix Error : " << errorNorm << std::endl;
328 Real testTolerance (1e-10);
330 if (errorNorm < testTolerance)
332 return ( EXIT_SUCCESS );
334 return ( EXIT_FAILURE );
int main(int argc, char **argv)
MatrixEpetra< Real > matrix_Type
double Real
Generic real data.
RegionMesh< LinearTetra > mesh_Type