33 #include <Epetra_ConfigDefs.h> 36 #include <Epetra_MpiComm.h> 38 #include <Epetra_SerialComm.h> 41 #include <boost/shared_ptr.hpp> 43 #include <lifev/core/LifeV.cpp> 44 #include <lifev/core/filter/ParserGmsh.hpp> 45 #include <lifev/core/mesh/ConvertBareMesh.hpp> 47 #include <lifev/core/fem/GeometricMap.hpp> 48 #include <lifev/core/fem/ReferenceFEScalar.hpp> 49 #include <lifev/core/fem/CurrentFE.hpp> 64 typedef typename mesh_t::elements_Type
elms_t;
72 bool ilead = (comm->MyPID() == 0);
76 if (!LifeV::MeshIO::ReadGmshFile (filename, baremesh, 1, ilead) )
82 std::shared_ptr<mesh_t> mesh (
new mesh_t (comm) );
83 LifeV::convertBareMesh (baremesh, *mesh, ilead);
86 LifeV::CurrentFE curFE (reffem, geomap, LifeV::quadRuleQuad4pt);
88 elms_t& elms = mesh->elementList();
90 LifeV::Real area (0.0);
93 for (elms_citer it = elms.begin(); it != elms.end(); ++it)
96 curFE.update (*it, LifeV::UPDATE_WDET);
98 const LifeV::UInt nbQuadPt (curFE.nbQuadPt() );
100 for (LifeV::UInt iQuadPt (0); iQuadPt < nbQuadPt; ++iQuadPt)
102 area += curFE.wDetJacobian (iQuadPt);
109 int main (
int argc,
char* argv[])
113 MPI_Init (&argc, &argv);
114 std::shared_ptr<Epetra_Comm> comm (
new Epetra_MpiComm (MPI_COMM_WORLD) );
116 std::shared_ptr<Epetra_Comm> comm (
new Epetra_SerialComm);
122 std::cout <<
"Usage: " << argv[0] <<
" [mesh_2D_Q1] [mesh_2D_Q2]" << std::endl;
127 std::string file1 = argv[1];
128 std::string file2 = argv[2];
130 bool ilead = (comm->MyPID() == 0);
133 LifeV::Real area_exact = 3. *
M_PI;
137 std::cout <<
"\n ====== LINEAR MESH ====== \n\n";
140 LifeV::Real v1 = tester<LifeV::LinearQuad>::volume
141 (file1, LifeV::feQuadQ1, LifeV::geoBilinearQuad, comm);
143 if (ilead) std::cout <<
"\n :: Total area = " 144 << std::setprecision (10) << v1
145 <<
"\n :: Exact area = " 148 << std::setprecision (3)
149 << std::abs (v1 - area_exact) / area_exact * 100 <<
" %" 154 std::cout <<
"\n ====== QUADRATIC MESH ====== \n\n";
157 LifeV::Real v2 = tester<LifeV::QuadraticQuad>::volume
158 (file2, LifeV::feQuadQ2, LifeV::geoBiquadraticQuad, comm);
160 if (ilead) std::cout <<
"\n :: Total area = " 161 << std::setprecision (10) << v2
162 <<
"\n :: Exact area = " 165 << std::setprecision (3)
166 << std::abs (v2 - area_exact) / area_exact * 100 <<
" %\n" LifeV::ReferenceFE reffem_t
static LifeV::Real volume(std::string &filename, const reffem_t &reffem, const geomap_t &geomap, comm_t comm)
LifeV::RegionMesh< S > mesh_t
std::shared_ptr< Epetra_Comm > comm_t
LifeV::GeometricMap geomap_t
int main(int argc, char **argv)
elms_t::const_iterator elms_citer