Select Git revision
-
Christophe Geuzaine authoredChristophe Geuzaine authored
meshGRegionExtruded.cpp 20.64 KiB
// Gmsh - Copyright (C) 1997-2019 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
#include <set>
#include "GmshConfig.h"
#include "GmshMessage.h"
#include "GModel.h"
#include "MTriangle.h"
#include "MQuadrangle.h"
#include "MTetrahedron.h"
#include "MHexahedron.h"
#include "MPrism.h"
#include "MPyramid.h"
#include "ExtrudeParams.h"
#include "meshGFace.h"
#include "meshGRegion.h"
#include "Context.h"
#include "MVertexRTree.h"
#if defined(HAVE_QUADTRI)
#include "QuadTriExtruded3D.h"
#endif
static void addTetrahedron(MVertex *v1, MVertex *v2, MVertex *v3, MVertex *v4,
GRegion *to)
{
to->tetrahedra.push_back(new MTetrahedron(v1, v2, v3, v4));
}
static void addPyramid(MVertex *v1, MVertex *v2, MVertex *v3, MVertex *v4,
MVertex *v5, GRegion *to)
{
to->pyramids.push_back(new MPyramid(v1, v2, v3, v4, v5));
}
static void addPrism(MVertex *v1, MVertex *v2, MVertex *v3, MVertex *v4,
MVertex *v5, MVertex *v6, GRegion *to)
{
to->prisms.push_back(new MPrism(v1, v2, v3, v4, v5, v6));
}
static void addHexahedron(MVertex *v1, MVertex *v2, MVertex *v3, MVertex *v4,
MVertex *v5, MVertex *v6, MVertex *v7, MVertex *v8,
GRegion *to)
{
to->hexahedra.push_back(new MHexahedron(v1, v2, v3, v4, v5, v6, v7, v8));
}
static void createPriPyrTet(std::vector<MVertex *> &v, GRegion *to,
MElement *source)
{
int dup[3];
int j = 0;
for(int i = 0; i < 3; i++)
if(v[i] == v[i + 3]) dup[j++] = i;
if(j == 2) {
if(dup[0] == 0 && dup[1] == 1)
addTetrahedron(v[0], v[1], v[2], v[5], to);
else if(dup[0] == 1 && dup[1] == 2)
addTetrahedron(v[0], v[1], v[2], v[3], to);
else
addTetrahedron(v[0], v[1], v[2], v[4], to);
}
else if(j == 1) {
if(dup[0] == 0)
addPyramid(v[1], v[4], v[5], v[2], v[0], to);
else if(dup[0] == 1)