MeshPart: apply clang format
This commit is contained in:
@@ -22,12 +22,12 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <algorithm>
|
||||
#include <algorithm>
|
||||
|
||||
# include <BRepMesh_IncrementalMesh.hxx>
|
||||
# include <BRepTools.hxx>
|
||||
# include <Standard_Version.hxx>
|
||||
# include <TopoDS_Shape.hxx>
|
||||
#include <BRepMesh_IncrementalMesh.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <Standard_Version.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
@@ -40,47 +40,47 @@
|
||||
|
||||
#ifdef HAVE_SMESH
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Woverloaded-virtual"
|
||||
# pragma clang diagnostic ignored "-Wextra-semi"
|
||||
#elif defined (__GNUC__)
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Woverloaded-virtual"
|
||||
#pragma clang diagnostic ignored "-Wextra-semi"
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#endif
|
||||
|
||||
#include <SMESH_Gen.hxx>
|
||||
#include <StdMeshers_MaxLength.hxx>
|
||||
#include <SMESH_Mesh.hxx>
|
||||
#include <SMESHDS_Mesh.hxx>
|
||||
#include <SMESH_Gen.hxx>
|
||||
#include <SMESH_Mesh.hxx>
|
||||
#include <StdMeshers_MaxLength.hxx>
|
||||
|
||||
#if SMESH_VERSION_MAJOR < 7
|
||||
#include <StdMeshers_TrianglePreference.hxx>
|
||||
#endif
|
||||
|
||||
#include <StdMeshers_LocalLength.hxx>
|
||||
#include <StdMeshers_NumberOfSegments.hxx>
|
||||
#include <StdMeshers_AutomaticLength.hxx>
|
||||
#include <StdMeshers_MEFISTO_2D.hxx>
|
||||
#include <StdMeshers_Deflection1D.hxx>
|
||||
#include <StdMeshers_Arithmetic1D.hxx>
|
||||
#include <StdMeshers_AutomaticLength.hxx>
|
||||
#include <StdMeshers_Deflection1D.hxx>
|
||||
#include <StdMeshers_LocalLength.hxx>
|
||||
#include <StdMeshers_MEFISTO_2D.hxx>
|
||||
#include <StdMeshers_MaxElementArea.hxx>
|
||||
#include <StdMeshers_Regular_1D.hxx>
|
||||
#include <StdMeshers_NumberOfSegments.hxx>
|
||||
#include <StdMeshers_QuadranglePreference.hxx>
|
||||
#include <StdMeshers_Quadrangle_2D.hxx>
|
||||
#include <StdMeshers_Regular_1D.hxx>
|
||||
|
||||
#include <StdMeshers_LengthFromEdges.hxx>
|
||||
#include <StdMeshers_NotConformAllowed.hxx>
|
||||
#if defined(HAVE_NETGEN)
|
||||
#include <NETGENPlugin_NETGEN_2D.hxx>
|
||||
#include <NETGENPlugin_Hypothesis_2D.hxx>
|
||||
#include <NETGENPlugin_NETGEN_2D.hxx>
|
||||
#include <NETGENPlugin_SimpleHypothesis_2D.hxx>
|
||||
#endif // HAVE_NETGEN
|
||||
#endif// HAVE_NETGEN
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic pop
|
||||
#elif defined (__GNUC__)
|
||||
# pragma GCC diagnostic pop
|
||||
#pragma clang diagnostic pop
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif // HAVE_SMESH
|
||||
#endif// HAVE_SMESH
|
||||
|
||||
using namespace MeshPart;
|
||||
|
||||
@@ -94,8 +94,9 @@ MeshingOutput::MeshingOutput()
|
||||
|
||||
int MeshingOutput::overflow(int c)
|
||||
{
|
||||
if (c != EOF)
|
||||
if (c != EOF) {
|
||||
buffer.push_back((char)c);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -108,7 +109,7 @@ int MeshingOutput::sync()
|
||||
std::string sub;
|
||||
if (pos != std::string::npos) {
|
||||
// chop the last newline
|
||||
sub = buffer.substr(pos+3, buffer.size()-pos-4);
|
||||
sub = buffer.substr(pos + 3, buffer.size() - pos - 4);
|
||||
}
|
||||
else {
|
||||
sub = buffer;
|
||||
@@ -122,16 +123,20 @@ int MeshingOutput::sync()
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
namespace MeshPart {
|
||||
namespace MeshPart
|
||||
{
|
||||
|
||||
struct Vertex {
|
||||
struct Vertex
|
||||
{
|
||||
static const double deflection;
|
||||
Standard_Real x,y,z;
|
||||
Standard_Real x, y, z;
|
||||
Standard_Integer i = 0;
|
||||
mutable MeshCore::MeshPoint p;
|
||||
|
||||
Vertex(Standard_Real X, Standard_Real Y, Standard_Real Z)
|
||||
: x(X),y(Y),z(Z)
|
||||
: x(X)
|
||||
, y(Y)
|
||||
, z(Z)
|
||||
{
|
||||
p.x = static_cast<float>(x);
|
||||
p.y = static_cast<float>(y);
|
||||
@@ -143,15 +148,18 @@ struct Vertex {
|
||||
return p;
|
||||
}
|
||||
|
||||
bool operator < (const Vertex &v) const
|
||||
bool operator<(const Vertex& v) const
|
||||
{
|
||||
if (fabs ( this->x - v.x) >= deflection)
|
||||
if (fabs(this->x - v.x) >= deflection) {
|
||||
return this->x < v.x;
|
||||
if (fabs ( this->y - v.y) >= deflection)
|
||||
}
|
||||
if (fabs(this->y - v.y) >= deflection) {
|
||||
return this->y < v.y;
|
||||
if (fabs ( this->z - v.z) >= deflection)
|
||||
}
|
||||
if (fabs(this->z - v.z) >= deflection) {
|
||||
return this->z < v.z;
|
||||
return false; // points are considered to be equal
|
||||
}
|
||||
return false;// points are considered to be equal
|
||||
}
|
||||
};
|
||||
|
||||
@@ -159,20 +167,21 @@ const double Vertex::deflection = gp::Resolution();
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class BrepMesh {
|
||||
class BrepMesh
|
||||
{
|
||||
bool segments;
|
||||
std::vector<uint32_t> colors;
|
||||
|
||||
public:
|
||||
BrepMesh(bool s, const std::vector<uint32_t>& c)
|
||||
: segments(s)
|
||||
, colors(c)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
Mesh::MeshObject* create(const std::vector<Part::TopoShape::Domain>& domains) const
|
||||
{
|
||||
std::map<uint32_t, std::vector<std::size_t> > colorMap;
|
||||
for (std::size_t i=0; i<colors.size(); i++) {
|
||||
std::map<uint32_t, std::vector<std::size_t>> colorMap;
|
||||
for (std::size_t i = 0; i < colors.size(); i++) {
|
||||
colorMap[colors[i]].push_back(i);
|
||||
}
|
||||
|
||||
@@ -180,8 +189,9 @@ public:
|
||||
|
||||
MeshCore::MeshFacetArray faces;
|
||||
std::size_t numTriangles = 0;
|
||||
for (const auto& it : domains)
|
||||
for (const auto& it : domains) {
|
||||
numTriangles += it.facets.size();
|
||||
}
|
||||
faces.reserve(numTriangles);
|
||||
|
||||
std::set<Vertex> vertices;
|
||||
@@ -189,7 +199,7 @@ public:
|
||||
Standard_Real x2, y2, z2;
|
||||
Standard_Real x3, y3, z3;
|
||||
|
||||
std::vector< std::vector<MeshCore::FacetIndex> > meshSegments;
|
||||
std::vector<std::vector<MeshCore::FacetIndex>> meshSegments;
|
||||
std::size_t numMeshFaces = 0;
|
||||
|
||||
for (const auto& domain : domains) {
|
||||
@@ -212,7 +222,7 @@ public:
|
||||
MeshCore::MeshFacet face;
|
||||
|
||||
// 1st vertex
|
||||
Vertex v1(x1,y1,z1);
|
||||
Vertex v1(x1, y1, z1);
|
||||
it = vertices.find(v1);
|
||||
if (it == vertices.end()) {
|
||||
v1.i = vertices.size();
|
||||
@@ -224,7 +234,7 @@ public:
|
||||
}
|
||||
|
||||
// 2nd vertex
|
||||
Vertex v2(x2,y2,z2);
|
||||
Vertex v2(x2, y2, z2);
|
||||
it = vertices.find(v2);
|
||||
if (it == vertices.end()) {
|
||||
v2.i = vertices.size();
|
||||
@@ -236,7 +246,7 @@ public:
|
||||
}
|
||||
|
||||
// 3rd vertex
|
||||
Vertex v3(x3,y3,z3);
|
||||
Vertex v3(x3, y3, z3);
|
||||
it = vertices.find(v3);
|
||||
if (it == vertices.end()) {
|
||||
v3.i = vertices.size();
|
||||
@@ -248,9 +258,9 @@ public:
|
||||
}
|
||||
|
||||
// make sure that we don't insert invalid facets
|
||||
if (face._aulPoints[0] != face._aulPoints[1] &&
|
||||
face._aulPoints[1] != face._aulPoints[2] &&
|
||||
face._aulPoints[2] != face._aulPoints[0]) {
|
||||
if (face._aulPoints[0] != face._aulPoints[1]
|
||||
&& face._aulPoints[1] != face._aulPoints[2]
|
||||
&& face._aulPoints[2] != face._aulPoints[0]) {
|
||||
faces.push_back(face);
|
||||
numDomainFaces++;
|
||||
}
|
||||
@@ -259,7 +269,9 @@ public:
|
||||
// add a segment for the face
|
||||
if (createSegm || this->segments) {
|
||||
std::vector<MeshCore::FacetIndex> segment(numDomainFaces);
|
||||
std::generate(segment.begin(), segment.end(), Base::iotaGen<MeshCore::FacetIndex>(numMeshFaces));
|
||||
std::generate(segment.begin(),
|
||||
segment.end(),
|
||||
Base::iotaGen<MeshCore::FacetIndex>(numMeshFaces));
|
||||
numMeshFaces += numDomainFaces;
|
||||
meshSegments.push_back(segment);
|
||||
}
|
||||
@@ -267,8 +279,9 @@ public:
|
||||
|
||||
MeshCore::MeshPointArray verts;
|
||||
verts.resize(vertices.size());
|
||||
for (const auto& it : vertices)
|
||||
for (const auto& it : vertices) {
|
||||
verts[it.i] = it.toPoint();
|
||||
}
|
||||
|
||||
MeshCore::MeshKernel kernel;
|
||||
kernel.Adopt(verts, faces, true);
|
||||
@@ -300,14 +313,13 @@ public:
|
||||
return meshdata;
|
||||
}
|
||||
};
|
||||
}
|
||||
}// namespace MeshPart
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Mesher::Mesher(const TopoDS_Shape& s)
|
||||
: shape(s)
|
||||
{
|
||||
}
|
||||
: shape(s)
|
||||
{}
|
||||
|
||||
Mesher::~Mesher() = default;
|
||||
|
||||
@@ -337,8 +349,9 @@ Mesh::MeshObject* Mesher::createMesh() const
|
||||
#else
|
||||
std::list<SMESH_Hypothesis*> hypoth;
|
||||
|
||||
if (!Mesher::_mesh_gen)
|
||||
if (!Mesher::_mesh_gen) {
|
||||
Mesher::_mesh_gen = new SMESH_Gen();
|
||||
}
|
||||
SMESH_Gen* meshgen = Mesher::_mesh_gen;
|
||||
|
||||
#if SMESH_VERSION_MAJOR >= 9
|
||||
@@ -348,137 +361,147 @@ Mesh::MeshObject* Mesher::createMesh() const
|
||||
#endif
|
||||
|
||||
|
||||
int hyp=0;
|
||||
int hyp = 0;
|
||||
|
||||
switch (method) {
|
||||
#if defined (HAVE_NETGEN)
|
||||
case Netgen: {
|
||||
#if defined(HAVE_NETGEN)
|
||||
case Netgen: {
|
||||
#if SMESH_VERSION_MAJOR >= 9
|
||||
NETGENPlugin_Hypothesis_2D* hyp2d = new NETGENPlugin_Hypothesis_2D(hyp++,meshgen);
|
||||
NETGENPlugin_Hypothesis_2D* hyp2d = new NETGENPlugin_Hypothesis_2D(hyp++, meshgen);
|
||||
#else
|
||||
NETGENPlugin_Hypothesis_2D* hyp2d = new NETGENPlugin_Hypothesis_2D(hyp++,0,meshgen);
|
||||
NETGENPlugin_Hypothesis_2D* hyp2d = new NETGENPlugin_Hypothesis_2D(hyp++, 0, meshgen);
|
||||
#endif
|
||||
|
||||
if (fineness >=0 && fineness < 5) {
|
||||
hyp2d->SetFineness(NETGENPlugin_Hypothesis_2D::Fineness(fineness));
|
||||
}
|
||||
// user defined values
|
||||
else {
|
||||
if (growthRate > 0)
|
||||
hyp2d->SetGrowthRate(growthRate);
|
||||
if (nbSegPerEdge > 0)
|
||||
hyp2d->SetNbSegPerEdge(nbSegPerEdge);
|
||||
if (nbSegPerRadius > 0)
|
||||
hyp2d->SetNbSegPerRadius(nbSegPerRadius);
|
||||
}
|
||||
if (fineness >= 0 && fineness < 5) {
|
||||
hyp2d->SetFineness(NETGENPlugin_Hypothesis_2D::Fineness(fineness));
|
||||
}
|
||||
// user defined values
|
||||
else {
|
||||
if (growthRate > 0) {
|
||||
hyp2d->SetGrowthRate(growthRate);
|
||||
}
|
||||
if (nbSegPerEdge > 0) {
|
||||
hyp2d->SetNbSegPerEdge(nbSegPerEdge);
|
||||
}
|
||||
if (nbSegPerRadius > 0) {
|
||||
hyp2d->SetNbSegPerRadius(nbSegPerRadius);
|
||||
}
|
||||
}
|
||||
|
||||
if (maxLen > 0)
|
||||
hyp2d->SetMaxSize(maxLen);
|
||||
if (minLen > 0)
|
||||
hyp2d->SetMinSize(minLen);
|
||||
if (maxLen > 0) {
|
||||
hyp2d->SetMaxSize(maxLen);
|
||||
}
|
||||
if (minLen > 0) {
|
||||
hyp2d->SetMinSize(minLen);
|
||||
}
|
||||
|
||||
hyp2d->SetQuadAllowed(allowquad);
|
||||
hyp2d->SetOptimize(optimize);
|
||||
hyp2d->SetSecondOrder(secondOrder); // apply bisecting to create four triangles out of one
|
||||
hypoth.push_back(hyp2d);
|
||||
|
||||
#if SMESH_VERSION_MAJOR >= 9
|
||||
NETGENPlugin_NETGEN_2D* alg2d = new NETGENPlugin_NETGEN_2D(hyp++,meshgen);
|
||||
#else
|
||||
NETGENPlugin_NETGEN_2D* alg2d = new NETGENPlugin_NETGEN_2D(hyp++,0,meshgen);
|
||||
#endif
|
||||
hypoth.push_back(alg2d);
|
||||
} break;
|
||||
#endif
|
||||
#if defined (HAVE_MEFISTO)
|
||||
case Mefisto: {
|
||||
if (maxLength > 0) {
|
||||
#if SMESH_VERSION_MAJOR >= 9
|
||||
StdMeshers_MaxLength* hyp1d = new StdMeshers_MaxLength(hyp++, meshgen);
|
||||
#else
|
||||
StdMeshers_MaxLength* hyp1d = new StdMeshers_MaxLength(hyp++, 0, meshgen);
|
||||
#endif
|
||||
hyp1d->SetLength(maxLength);
|
||||
hypoth.push_back(hyp1d);
|
||||
}
|
||||
else if (localLength > 0) {
|
||||
#if SMESH_VERSION_MAJOR >= 9
|
||||
StdMeshers_LocalLength* hyp1d = new StdMeshers_LocalLength(hyp++,meshgen);
|
||||
#else
|
||||
StdMeshers_LocalLength* hyp1d = new StdMeshers_LocalLength(hyp++,0,meshgen);
|
||||
#endif
|
||||
hyp1d->SetLength(localLength);
|
||||
hypoth.push_back(hyp1d);
|
||||
}
|
||||
else if (maxArea > 0) {
|
||||
#if SMESH_VERSION_MAJOR >= 9
|
||||
StdMeshers_MaxElementArea* hyp2d = new StdMeshers_MaxElementArea(hyp++,meshgen);
|
||||
#else
|
||||
StdMeshers_MaxElementArea* hyp2d = new StdMeshers_MaxElementArea(hyp++,0,meshgen);
|
||||
#endif
|
||||
hyp2d->SetMaxArea(maxArea);
|
||||
hyp2d->SetQuadAllowed(allowquad);
|
||||
hyp2d->SetOptimize(optimize);
|
||||
hyp2d->SetSecondOrder(
|
||||
secondOrder);// apply bisecting to create four triangles out of one
|
||||
hypoth.push_back(hyp2d);
|
||||
}
|
||||
else if (deflection > 0) {
|
||||
#if SMESH_VERSION_MAJOR >= 9
|
||||
StdMeshers_Deflection1D* hyp1d = new StdMeshers_Deflection1D(hyp++,meshgen);
|
||||
#else
|
||||
StdMeshers_Deflection1D* hyp1d = new StdMeshers_Deflection1D(hyp++,0,meshgen);
|
||||
#endif
|
||||
hyp1d->SetDeflection(deflection);
|
||||
hypoth.push_back(hyp1d);
|
||||
}
|
||||
else if (minLen > 0 && maxLen > 0) {
|
||||
#if SMESH_VERSION_MAJOR >= 9
|
||||
StdMeshers_Arithmetic1D* hyp1d = new StdMeshers_Arithmetic1D(hyp++,meshgen);
|
||||
#else
|
||||
StdMeshers_Arithmetic1D* hyp1d = new StdMeshers_Arithmetic1D(hyp++,0,meshgen);
|
||||
#endif
|
||||
hyp1d->SetLength(minLen, false);
|
||||
hyp1d->SetLength(maxLen, true);
|
||||
hypoth.push_back(hyp1d);
|
||||
}
|
||||
else {
|
||||
#if SMESH_VERSION_MAJOR >= 9
|
||||
StdMeshers_AutomaticLength* hyp1d = new StdMeshers_AutomaticLength(hyp++,meshgen);
|
||||
#else
|
||||
StdMeshers_AutomaticLength* hyp1d = new StdMeshers_AutomaticLength(hyp++,0,meshgen);
|
||||
#endif
|
||||
hypoth.push_back(hyp1d);
|
||||
}
|
||||
|
||||
{
|
||||
#if SMESH_VERSION_MAJOR >= 9
|
||||
StdMeshers_NumberOfSegments* hyp1d = new StdMeshers_NumberOfSegments(hyp++,meshgen);
|
||||
NETGENPlugin_NETGEN_2D* alg2d = new NETGENPlugin_NETGEN_2D(hyp++, meshgen);
|
||||
#else
|
||||
StdMeshers_NumberOfSegments* hyp1d = new StdMeshers_NumberOfSegments(hyp++,0,meshgen);
|
||||
NETGENPlugin_NETGEN_2D* alg2d = new NETGENPlugin_NETGEN_2D(hyp++, 0, meshgen);
|
||||
#endif
|
||||
hyp1d->SetNumberOfSegments(1);
|
||||
hypoth.push_back(hyp1d);
|
||||
}
|
||||
hypoth.push_back(alg2d);
|
||||
} break;
|
||||
#endif
|
||||
#if defined(HAVE_MEFISTO)
|
||||
case Mefisto: {
|
||||
if (maxLength > 0) {
|
||||
#if SMESH_VERSION_MAJOR >= 9
|
||||
StdMeshers_MaxLength* hyp1d = new StdMeshers_MaxLength(hyp++, meshgen);
|
||||
#else
|
||||
StdMeshers_MaxLength* hyp1d = new StdMeshers_MaxLength(hyp++, 0, meshgen);
|
||||
#endif
|
||||
hyp1d->SetLength(maxLength);
|
||||
hypoth.push_back(hyp1d);
|
||||
}
|
||||
else if (localLength > 0) {
|
||||
#if SMESH_VERSION_MAJOR >= 9
|
||||
StdMeshers_LocalLength* hyp1d = new StdMeshers_LocalLength(hyp++, meshgen);
|
||||
#else
|
||||
StdMeshers_LocalLength* hyp1d = new StdMeshers_LocalLength(hyp++, 0, meshgen);
|
||||
#endif
|
||||
hyp1d->SetLength(localLength);
|
||||
hypoth.push_back(hyp1d);
|
||||
}
|
||||
else if (maxArea > 0) {
|
||||
#if SMESH_VERSION_MAJOR >= 9
|
||||
StdMeshers_MaxElementArea* hyp2d = new StdMeshers_MaxElementArea(hyp++, meshgen);
|
||||
#else
|
||||
StdMeshers_MaxElementArea* hyp2d = new StdMeshers_MaxElementArea(hyp++, 0, meshgen);
|
||||
#endif
|
||||
hyp2d->SetMaxArea(maxArea);
|
||||
hypoth.push_back(hyp2d);
|
||||
}
|
||||
else if (deflection > 0) {
|
||||
#if SMESH_VERSION_MAJOR >= 9
|
||||
StdMeshers_Deflection1D* hyp1d = new StdMeshers_Deflection1D(hyp++, meshgen);
|
||||
#else
|
||||
StdMeshers_Deflection1D* hyp1d = new StdMeshers_Deflection1D(hyp++, 0, meshgen);
|
||||
#endif
|
||||
hyp1d->SetDeflection(deflection);
|
||||
hypoth.push_back(hyp1d);
|
||||
}
|
||||
else if (minLen > 0 && maxLen > 0) {
|
||||
#if SMESH_VERSION_MAJOR >= 9
|
||||
StdMeshers_Arithmetic1D* hyp1d = new StdMeshers_Arithmetic1D(hyp++, meshgen);
|
||||
#else
|
||||
StdMeshers_Arithmetic1D* hyp1d = new StdMeshers_Arithmetic1D(hyp++, 0, meshgen);
|
||||
#endif
|
||||
hyp1d->SetLength(minLen, false);
|
||||
hyp1d->SetLength(maxLen, true);
|
||||
hypoth.push_back(hyp1d);
|
||||
}
|
||||
else {
|
||||
#if SMESH_VERSION_MAJOR >= 9
|
||||
StdMeshers_AutomaticLength* hyp1d = new StdMeshers_AutomaticLength(hyp++, meshgen);
|
||||
#else
|
||||
StdMeshers_AutomaticLength* hyp1d =
|
||||
new StdMeshers_AutomaticLength(hyp++, 0, meshgen);
|
||||
#endif
|
||||
hypoth.push_back(hyp1d);
|
||||
}
|
||||
|
||||
if (regular) {
|
||||
{
|
||||
#if SMESH_VERSION_MAJOR >= 9
|
||||
StdMeshers_Regular_1D* hyp1d = new StdMeshers_Regular_1D(hyp++,meshgen);
|
||||
StdMeshers_NumberOfSegments* hyp1d =
|
||||
new StdMeshers_NumberOfSegments(hyp++, meshgen);
|
||||
#else
|
||||
StdMeshers_Regular_1D* hyp1d = new StdMeshers_Regular_1D(hyp++,0,meshgen);
|
||||
StdMeshers_NumberOfSegments* hyp1d =
|
||||
new StdMeshers_NumberOfSegments(hyp++, 0, meshgen);
|
||||
#endif
|
||||
hypoth.push_back(hyp1d);
|
||||
}
|
||||
hyp1d->SetNumberOfSegments(1);
|
||||
hypoth.push_back(hyp1d);
|
||||
}
|
||||
|
||||
if (regular) {
|
||||
#if SMESH_VERSION_MAJOR >= 9
|
||||
StdMeshers_Regular_1D* hyp1d = new StdMeshers_Regular_1D(hyp++, meshgen);
|
||||
#else
|
||||
StdMeshers_Regular_1D* hyp1d = new StdMeshers_Regular_1D(hyp++, 0, meshgen);
|
||||
#endif
|
||||
hypoth.push_back(hyp1d);
|
||||
}
|
||||
#if SMESH_VERSION_MAJOR < 7
|
||||
StdMeshers_TrianglePreference* hyp2d_1 = new StdMeshers_TrianglePreference(hyp++,0,meshgen);
|
||||
hypoth.push_back(hyp2d_1);
|
||||
StdMeshers_TrianglePreference* hyp2d_1 =
|
||||
new StdMeshers_TrianglePreference(hyp++, 0, meshgen);
|
||||
hypoth.push_back(hyp2d_1);
|
||||
#endif
|
||||
#if SMESH_VERSION_MAJOR >= 9
|
||||
StdMeshers_MEFISTO_2D* alg2d = new StdMeshers_MEFISTO_2D(hyp++,meshgen);
|
||||
StdMeshers_MEFISTO_2D* alg2d = new StdMeshers_MEFISTO_2D(hyp++, meshgen);
|
||||
#else
|
||||
StdMeshers_MEFISTO_2D* alg2d = new StdMeshers_MEFISTO_2D(hyp++,0,meshgen);
|
||||
StdMeshers_MEFISTO_2D* alg2d = new StdMeshers_MEFISTO_2D(hyp++, 0, meshgen);
|
||||
#endif
|
||||
hypoth.push_back(alg2d);
|
||||
} break;
|
||||
hypoth.push_back(alg2d);
|
||||
} break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Set new cout
|
||||
@@ -487,8 +510,9 @@ Mesh::MeshObject* Mesher::createMesh() const
|
||||
|
||||
// Apply the hypothesis and create the mesh
|
||||
mesh->ShapeToMesh(shape);
|
||||
for (int i=0; i<hyp;i++)
|
||||
for (int i = 0; i < hyp; i++) {
|
||||
mesh->AddHypothesis(shape, i);
|
||||
}
|
||||
meshgen->Compute(*mesh, mesh->GetShapeToMesh());
|
||||
|
||||
// Restore old cout
|
||||
@@ -502,11 +526,12 @@ Mesh::MeshObject* Mesher::createMesh() const
|
||||
mesh->ShapeToMesh(aNull);
|
||||
mesh->Clear();
|
||||
delete mesh;
|
||||
for (auto it : hypoth)
|
||||
for (auto it : hypoth) {
|
||||
delete it;
|
||||
}
|
||||
|
||||
return meshdata;
|
||||
#endif // HAVE_SMESH
|
||||
#endif// HAVE_SMESH
|
||||
}
|
||||
|
||||
Mesh::MeshObject* Mesher::createFrom(SMESH_Mesh* mesh) const
|
||||
@@ -520,9 +545,9 @@ Mesh::MeshObject* Mesher::createFrom(SMESH_Mesh* mesh) const
|
||||
verts.reserve(mesh->NbNodes());
|
||||
faces.reserve(mesh->NbFaces());
|
||||
|
||||
int index=0;
|
||||
int index = 0;
|
||||
std::map<const SMDS_MeshNode*, int> mapNodeIndex;
|
||||
for (;aNodeIter->more();) {
|
||||
for (; aNodeIter->more();) {
|
||||
const SMDS_MeshNode* aNode = aNodeIter->next();
|
||||
MeshCore::MeshPoint p;
|
||||
p.Set((float)aNode->X(), (float)aNode->Y(), (float)aNode->Z());
|
||||
@@ -530,11 +555,11 @@ Mesh::MeshObject* Mesher::createFrom(SMESH_Mesh* mesh) const
|
||||
mapNodeIndex[aNode] = index++;
|
||||
}
|
||||
|
||||
for (;aFaceIter->more();) {
|
||||
for (; aFaceIter->more();) {
|
||||
const SMDS_MeshFace* aFace = aFaceIter->next();
|
||||
if (aFace->NbNodes() == 3) {
|
||||
MeshCore::MeshFacet f;
|
||||
for (int i=0; i<3;i++) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
const SMDS_MeshNode* node = aFace->GetNode(i);
|
||||
f._aulPoints[i] = mapNodeIndex[node];
|
||||
}
|
||||
@@ -617,12 +642,12 @@ Mesh::MeshObject* Mesher::createFrom(SMESH_Mesh* mesh) const
|
||||
|
||||
// Two solutions are possible:
|
||||
// <4,6,7>, <4,5,6> or <4,5,7>, <5,6,7>
|
||||
Base::Vector3d v4(node4->X(),node4->Y(),node4->Z());
|
||||
Base::Vector3d v5(node5->X(),node5->Y(),node5->Z());
|
||||
Base::Vector3d v6(node6->X(),node6->Y(),node6->Z());
|
||||
Base::Vector3d v7(node7->X(),node7->Y(),node7->Z());
|
||||
double dist46 = Base::DistanceP2(v4,v6);
|
||||
double dist57 = Base::DistanceP2(v5,v7);
|
||||
Base::Vector3d v4(node4->X(), node4->Y(), node4->Z());
|
||||
Base::Vector3d v5(node5->X(), node5->Y(), node5->Z());
|
||||
Base::Vector3d v6(node6->X(), node6->Y(), node6->Z());
|
||||
Base::Vector3d v7(node7->X(), node7->Y(), node7->Z());
|
||||
double dist46 = Base::DistanceP2(v4, v6);
|
||||
double dist57 = Base::DistanceP2(v5, v7);
|
||||
if (dist46 > dist57) {
|
||||
f5._aulPoints[0] = mapNodeIndex[node4];
|
||||
f5._aulPoints[1] = mapNodeIndex[node6];
|
||||
|
||||
Reference in New Issue
Block a user