Remove MeshPy::coarsen() and code using GTS

FC_USE_GTS not used since before:
1162aaea88 ("Remove references to gts and ode", 2012-07-05)

GTSAlgos.h and GTSAlgos.cpp removed in:
db5c8f7db8 ("[Mesh] remove GTSAlgos", 2022-11-11)

MeshPy::coarsen() added not later than 2011 and never implemented.
This commit is contained in:
Chris Mayo
2024-11-20 19:37:46 +00:00
committed by wwmayer
parent edef0ba3c0
commit 7aedf91a1c
8 changed files with 0 additions and 292 deletions

View File

@@ -1,2 +0,0 @@
GTSAlgos.cpp export-ignore
GTSAlgos.h export-ignore

View File

@@ -98,11 +98,6 @@ lines = mesh.section(mesh2, [ConnectLines=True, MinDist=0.0001])
</UserDocu>
</Documentation>
</Methode>
<Methode Name="coarsen">
<Documentation>
<UserDocu>Coarse the mesh</UserDocu>
</Documentation>
</Methode>
<Methode Name="translate">
<Documentation>
<UserDocu>Apply a translation to the mesh</UserDocu>

View File

@@ -593,15 +593,6 @@ PyObject* MeshPy::section(PyObject* args, PyObject* kwds)
return Py::new_reference_to(outer);
}
PyObject* MeshPy::coarsen(PyObject* args)
{
if (!PyArg_ParseTuple(args, "")) {
return nullptr;
}
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
return nullptr;
}
PyObject* MeshPy::translate(PyObject* args)
{
float x {};

View File

@@ -46,9 +46,6 @@
#include <fstream>
#include <ios>
#ifdef FC_USE_GTS
#include <gts.h>
#endif
// STL
#include <algorithm>
#include <iomanip>

View File

@@ -37,11 +37,6 @@
#ifdef _PreComp_
// Gts
#ifdef FC_USE_GTS
#include <gts.h>
#endif
// standard
#include <ios>
#include <cfloat>

View File

@@ -23,10 +23,6 @@
#ifndef _CurveProjector_h_
#define _CurveProjector_h_
#ifdef FC_USE_GTS
#include <gts.h>
#endif
#include <TopoDS_Edge.hxx>
#include <Mod/Mesh/App/Mesh.h>

View File

@@ -144,250 +144,6 @@ void MeshAlgos::offsetSpecial(MeshCore::MeshKernel* Mesh, float fSize, float zma
}
}
void MeshAlgos::coarsen(MeshCore::MeshKernel* /*Mesh*/, float /*f*/)
{
#ifdef FC_USE_GTS
GtsSurface* surface;
// create a GTS surface
surface = MeshAlgos::createGTSSurface(Mesh);
Mesh->Clear();
guint stop_number = 100000;
gdouble fold = 3.1415 / 180.;
gts_surface_coarsen(surface,
NULL,
NULL,
NULL,
NULL,
(GtsStopFunc)gts_coarsen_stop_number,
&stop_number,
fold);
// get the standard mesh
fillMeshFromGTSSurface(Mesh, surface);
#endif
}
MeshCore::MeshKernel* MeshAlgos::boolean(MeshCore::MeshKernel* pMesh1,
MeshCore::MeshKernel* /*pMesh2*/,
MeshCore::MeshKernel* /*pResult*/,
int /*Type*/)
{
#ifdef FC_USE_GTS
GtsSurface *s1, *s2, *s3;
GtsSurfaceInter* si;
GNode *tree1, *tree2;
gboolean check_self_intersection = false;
gboolean closed = true, is_open1, is_open2;
// create a GTS surface
s1 = MeshAlgos::createGTSSurface(pMesh1);
s2 = MeshAlgos::createGTSSurface(pMesh2);
/* check that the surfaces are orientable manifolds */
if (!gts_surface_is_orientable(s1)) {
gts_object_destroy(GTS_OBJECT(s1));
gts_object_destroy(GTS_OBJECT(s2));
throw std::runtime_error("surface 1 is not an orientable manifold\n");
}
if (!gts_surface_is_orientable(s2)) {
gts_object_destroy(GTS_OBJECT(s1));
gts_object_destroy(GTS_OBJECT(s2));
throw std::runtime_error("surface 2 is not an orientable manifold\n");
}
/* check that the surfaces are not self-intersecting */
if (check_self_intersection) {
GtsSurface* self_intersects;
self_intersects = gts_surface_is_self_intersecting(s1);
if (self_intersects != NULL) {
gts_object_destroy(GTS_OBJECT(self_intersects));
gts_object_destroy(GTS_OBJECT(s1));
gts_object_destroy(GTS_OBJECT(s2));
throw std::runtime_error("surface is self-intersecting\n");
}
self_intersects = gts_surface_is_self_intersecting(s2);
if (self_intersects != NULL) {
gts_object_destroy(GTS_OBJECT(self_intersects));
gts_object_destroy(GTS_OBJECT(s1));
gts_object_destroy(GTS_OBJECT(s2));
throw std::runtime_error("surface is self-intersecting\n");
}
}
/* build bounding box tree for first surface */
tree1 = gts_bb_tree_surface(s1);
is_open1 = gts_surface_volume(s1) < 0. ? true : false;
/* build bounding box tree for second surface */
tree2 = gts_bb_tree_surface(s2);
is_open2 = gts_surface_volume(s2) < 0. ? true : false;
si = gts_surface_inter_new(gts_surface_inter_class(), s1, s2, tree1, tree2, is_open1, is_open2);
g_assert(gts_surface_inter_check(si, &closed));
if (!closed) {
gts_object_destroy(GTS_OBJECT(s1));
gts_object_destroy(GTS_OBJECT(s2));
gts_bb_tree_destroy(tree1, true);
gts_bb_tree_destroy(tree2, true);
throw "the intersection of 1 and 2 is not a closed curve\n";
}
s3 = gts_surface_new(gts_surface_class(),
gts_face_class(),
gts_edge_class(),
gts_vertex_class());
if (Type == 0) { // union
gts_surface_inter_boolean(si, s3, GTS_1_OUT_2);
gts_surface_inter_boolean(si, s3, GTS_2_OUT_1);
}
else if (Type == 1) { // inter
gts_surface_inter_boolean(si, s3, GTS_1_IN_2);
gts_surface_inter_boolean(si, s3, GTS_2_IN_1);
}
else if (Type == 2) { // diff
gts_surface_inter_boolean(si, s3, GTS_1_OUT_2);
gts_surface_inter_boolean(si, s3, GTS_2_IN_1);
gts_surface_foreach_face(si->s2, (GtsFunc)gts_triangle_revert, NULL);
gts_surface_foreach_face(s2, (GtsFunc)gts_triangle_revert, NULL);
}
else if (Type == 3) { // cut inner
gts_surface_inter_boolean(si, s3, GTS_1_IN_2);
}
else if (Type == 4) { // cut outer
gts_surface_inter_boolean(si, s3, GTS_1_OUT_2);
}
// check that the resulting surface is not self-intersecting
if (check_self_intersection) {
GtsSurface* self_intersects;
self_intersects = gts_surface_is_self_intersecting(s3);
if (self_intersects != NULL) {
gts_object_destroy(GTS_OBJECT(self_intersects));
gts_object_destroy(GTS_OBJECT(s1));
gts_object_destroy(GTS_OBJECT(s2));
gts_object_destroy(GTS_OBJECT(s3));
gts_object_destroy(GTS_OBJECT(si));
gts_bb_tree_destroy(tree1, true);
gts_bb_tree_destroy(tree2, true);
throw std::runtime_error("the resulting surface is self-intersecting\n");
}
}
// display summary information about the resulting surface
// if (verbose)
// gts_surface_print_stats (s3, stderr);
// write resulting surface to standard output
// get the standard mesh
fillMeshFromGTSSurface(pResult, s3);
// destroy surfaces
gts_object_destroy(GTS_OBJECT(s1));
gts_object_destroy(GTS_OBJECT(s2));
#endif
return pMesh1;
}
#ifdef FC_USE_GTS
/// helper function - construct a Edge out of two Vertexes if not already there
static GtsEdge* new_edge(GtsVertex* v1, GtsVertex* v2)
{
GtsSegment* s = gts_vertices_are_connected(v1, v2);
if (s == NULL) {
return gts_edge_new(gts_edge_class(), v1, v2);
}
else {
return GTS_EDGE(s);
}
}
GtsSurface* MeshAlgos::createGTSSurface(MeshCore::MeshKernel* Mesh)
{
GtsSurface* Surf = gts_surface_new(gts_surface_class(),
gts_face_class(),
gts_edge_class(),
gts_vertex_class());
unsigned long p1, p2, p3;
Base::Vector3f Vertex;
// Getting all the points
GtsVertex** aVertex = (GtsVertex**)malloc(Mesh->CountPoints() * sizeof(GtsVertex*));
for (unsigned int PIter = 0; PIter < Mesh->CountPoints(); PIter++) {
Vertex = Mesh->GetPoint(PIter);
aVertex[PIter] = gts_vertex_new(gts_vertex_class(), Vertex.x, Vertex.y, Vertex.z);
}
// cycling through the facets
for (unsigned int pFIter = 0; pFIter < Mesh->CountFacets(); pFIter++) {
// getting the three points of the facet
Mesh->GetFacetPoints(pFIter, p1, p2, p3);
// creating the edges and add the face to the surface
gts_surface_add_face(Surf,
gts_face_new(Surf->face_class,
new_edge(aVertex[p1], aVertex[p2]),
new_edge(aVertex[p2], aVertex[p3]),
new_edge(aVertex[p3], aVertex[p1])));
}
Base::Console().Log("GTS [%d faces, %d Points, %d Edges,%s ,%s]\n",
gts_surface_face_number(Surf),
gts_surface_vertex_number(Surf),
gts_surface_edge_number(Surf),
gts_surface_is_orientable(Surf) ? "orientable" : "not orientable",
gts_surface_is_self_intersecting(Surf) ? "self-intersections"
: "no self-intersection");
return Surf;
}
/// helper function for the face (triangle iteration
static void onFaces(GtsTriangle* t, std::vector<MeshGeomFacet>* VAry)
{
GtsVertex *mv0, *mv1, *mv2;
gts_triangle_vertices(t, &mv0, &mv1, &mv2);
VAry->push_back(MeshGeomFacet(Base::Vector3f(mv0->p.x, mv0->p.y, mv0->p.z),
Base::Vector3f(mv1->p.x, mv1->p.y, mv1->p.z),
Base::Vector3f(mv2->p.x, mv2->p.y, mv2->p.z)));
}
void MeshAlgos::fillMeshFromGTSSurface(MeshCore::MeshKernel* pMesh, GtsSurface* pSurface)
{
std::vector<MeshGeomFacet> VAry;
// remove old mesh
pMesh->Clear();
gts_surface_foreach_face(pSurface, (GtsFunc)onFaces, &VAry);
// destroy surfaces
gts_object_destroy(GTS_OBJECT(pSurface));
// put the facets the simple way in the mesh, totp is recalculated!
(*pMesh) = VAry;
}
#endif
#include <BRep_Tool.hxx>
#include <GeomAPI_IntCS.hxx>
#include <GeomLProp_CLProps.hxx>

View File

@@ -23,10 +23,6 @@
#ifndef _MeshAlgos_h_
#define _MeshAlgos_h_
#ifdef FC_USE_GTS
#include <gts.h>
#endif
#include <vector>
#include "CurveProjector.h"
@@ -56,10 +52,6 @@ public:
static void offsetSpecial2(MeshCore::MeshKernel* Mesh, float fSize);
static void offsetSpecial(MeshCore::MeshKernel* Mesh, float fSize, float zmax, float zmin);
/** Coarsen the mesh
*/
static void coarsen(MeshCore::MeshKernel* Mesh, float f);
/** makes a boolean add
* The int Type stears the boolean oberation: 0=add;1=intersection;2=diff
*/
@@ -68,18 +60,6 @@ public:
MeshCore::MeshKernel* pResult,
int Type = 0);
#ifdef FC_USE_GTS
/** Creates a GTS Surface from a MeshKernel
*/
static GtsSurface* createGTSSurface(MeshCore::MeshKernel* Mesh);
/** Creates a GTS Surface from a MeshKernel
*/
static void fillMeshFromGTSSurface(MeshCore::MeshKernel* pMesh, GtsSurface* pSurface);
#endif
static void cutByShape(const TopoDS_Shape& aShape,
const MeshCore::MeshKernel* pMesh,
MeshCore::MeshKernel* pToolMesh);