39 #ifndef REGIONMESH1DSTRUCTURED_HPP 40 #define REGIONMESH1DSTRUCTURED_HPP 1
42 #include <lifev/core/LifeV.hpp> 43 #include <lifev/core/mesh/RegionMesh.hpp> 73 template <
typename MeshType>
76 const UInt& numberOfElements,
78 const Real& length = 1.,
79 const Real& origin = 0. )
81 typedef MeshType mesh_Type;
83 if ( verbose && mesh.comm()->MyPID() == 0 )
85 std::cout <<
"Building 1d mesh" << std::endl;
88 mesh.setMaxNumPoints (numberOfElements + 1,
true);
89 mesh.setNumBPoints (2);
90 mesh.setMarkerID (regionFlag);
92 Real deltax = (length - origin) / numberOfElements;
94 typename mesh_Type::point_Type* pp = 0;
96 for (
UInt it = 0; it < numberOfElements + 1; it++)
98 bool isBoundary = (it == numberOfElements) || ( it == 0);
101 pp = &mesh.addPoint ( isBoundary,
false );
102 pp->x() = origin + it * deltax;
109 pp->firstAdjacentElementIdentity() = 0;
110 pp->firstAdjacentElementPosition() = 0;
112 pp->secondAdjacentElementIdentity() =
NotAnId;
113 pp->secondAdjacentElementPosition() =
NotAnId;
117 else if ( it == numberOfElements )
119 pp->firstAdjacentElementIdentity() = it - 1;
120 pp->firstAdjacentElementPosition() = 1;
122 pp->secondAdjacentElementIdentity() =
NotAnId;
123 pp->secondAdjacentElementPosition() =
NotAnId;
129 pp->firstAdjacentElementIdentity() = it;
130 pp->firstAdjacentElementPosition() = 0;
132 pp->secondAdjacentElementIdentity() = it - 1;
133 pp->secondAdjacentElementPosition() = 1;
141 mesh.setNumGlobalVertices ( mesh.pointList.size() );
142 mesh.setNumVertices (mesh.pointList.size() );
143 mesh.setMaxNumPoints ( mesh.pointList.size(),
true );
144 mesh.setMaxNumGlobalPoints ( mesh.pointList.size() );
145 mesh.numBVertices() = 2;
146 mesh.setNumBPoints ( mesh.numBVertices() );
148 mesh.setLinkSwitch (
"FACETS_HAVE_ADIACENCY" );
149 mesh.setLinkSwitch (
"HAS_ALL_FACETS" );
151 mesh.setMaxNumEdges (numberOfElements,
true);
153 typename mesh_Type::edge_Type* pe = 0;
155 for (
UInt it = 0; it < numberOfElements; it++)
157 pe = &mesh.addEdge (
false );
158 pe->setPoint (0, mesh.point (it) );
159 pe->setPoint (1, mesh.point (it + 1) );
163 mesh.setNumEdges (mesh.edgeList.size() );
164 mesh.setMaxNumGlobalEdges (mesh.edgeList.size() );
166 mesh.updateElementFacets (
true,
false, mesh.pointList.size() );
const markerID_Type INTERNAL
Label for the internal entities.
const markerID_Type RIGHT
Label for the right boundary corner.
ID markerID_Type
markerID_Type is the type used to store the geometric entity marker IDs
void updateInverseJacobian(const UInt &iQuadPt)
double Real
Generic real data.
const markerID_Type LEFT
Label for the left boundary corner.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
void regularMesh1D(MeshType &mesh, markerID_Type regionFlag, const UInt &numberOfElements, bool verbose=false, const Real &length=1., const Real &origin=0.)
Build uniform mesh along the x axis.