Skip to content
Snippets Groups Projects
Commit a81c25ff authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

move DivideAndConquer to mesh module, since it now depends plenty of GModel

parent 7d01aacb
No related branches found
No related tags found
No related merge requests found
......@@ -10,11 +10,15 @@
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include "GmshConfig.h"
#include "SOrientedBoundingBox.h"
#include "fullMatrix.h"
#include "DivideAndConquer.h"
#include "SBoundingBox3d.h"
#if defined(HAVE_MESH)
#include "DivideAndConquer.h"
#endif
double SOrientedBoundingRectangle::area()
{
double b = size->at(0);
......@@ -201,6 +205,7 @@ bool SOrientedBoundingBox::intersects(SOrientedBoundingBox& obb)
SOrientedBoundingBox* SOrientedBoundingBox::buildOBB(std::vector<SPoint3> vertices)
{
#if defined(HAVE_MESH)
int num_vertices = vertices.size();
// First organize the data
fullMatrix<double> data(3,num_vertices);
......@@ -542,11 +547,15 @@ SOrientedBoundingBox* SOrientedBoundingBox::buildOBB(std::vector<SPoint3> vertic
Msg::Info("Box axis 1 : %f %f %f",Axis1[0],Axis1[1],Axis1[2]);
Msg::Info("Box axis 2 : %f %f %f",Axis2[0],Axis2[1],Axis2[2]);
Msg::Info("Box axis 3 : %f %f %f",Axis3[0],Axis3[1],Axis3[2]);
Msg::Info("Volume : %f", size[0]*size[1]*size[2]);
*/
return (new SOrientedBoundingBox(center,
size[0], size[1], size[2], Axis1, Axis2, Axis3));
#else
Msg::Error("SOrientedBoundingBox requires mesh module");
return 0;
#endif
}
double SOrientedBoundingBox::compare(SOrientedBoundingBox& obb1, SOrientedBoundingBox& obb2)
......
......@@ -32,6 +32,7 @@ CenterlineField.cpp
QuadTriUtils.cpp
QuadTriExtruded2D.cpp QuadTriExtruded3D.cpp QuadTriTransfinite3D.cpp
simple3D.cpp
DivideAndConquer.cpp
Voronoi3D.cpp
Levy3D.cpp
periodical.cpp
......
File moved
File moved
......@@ -23,7 +23,6 @@ set(SRC
robustPredicates.cpp
mathEvaluator.cpp
Iso.cpp
DivideAndConquer.cpp
)
file(GLOB HDR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h)
......
......@@ -4,6 +4,7 @@
// bugs and problems to <gmsh@geuz.org>.
#include <vector>
#include "GmshConfig.h"
#include "GModel.h"
#include "GmshMessage.h"
#include "Tetrahedralize.h"
......@@ -46,8 +47,8 @@ class PointData {
public:
std::vector<double> v;
PointData(double x, double y, double z, int numVal)
{
v.resize(3 + numVal);
{
v.resize(3 + numVal);
v[0] = x;
v[1] = y;
v[2] = z;
......@@ -130,13 +131,13 @@ PView *GMSH_TetrahedralizePlugin::execute(PView *v)
p[3] = &points[out.tetrahedronlist[i * 4 + 3]];
int numComp = 0;
std::vector<double> *vec = 0;
if((int)p[0]->v.size() == 3 + 9 * numSteps &&
if((int)p[0]->v.size() == 3 + 9 * numSteps &&
(int)p[1]->v.size() == 3 + 9 * numSteps &&
(int)p[2]->v.size() == 3 + 9 * numSteps &&
(int)p[3]->v.size() == 3 + 9 * numSteps){
numComp = 9; data2->NbTS++; vec = &data2->TS;
}
else if((int)p[0]->v.size() == 3 + 3 * numSteps &&
else if((int)p[0]->v.size() == 3 + 3 * numSteps &&
(int)p[1]->v.size() == 3 + 3 * numSteps &&
(int)p[2]->v.size() == 3 + 3 * numSteps &&
(int)p[2]->v.size() == 3 + 3 * numSteps){
......@@ -150,7 +151,7 @@ PView *GMSH_TetrahedralizePlugin::execute(PView *v)
for(int nod = 0; nod < 4; nod++) vec->push_back(p[nod]->v[2]);
for(int step = 0; step < numSteps; step++)
for(int nod = 0; nod < 4; nod++)
for(int comp = 0; comp < numComp; comp++)
for(int comp = 0; comp < numComp; comp++)
vec->push_back(p[nod]->v[3 + numComp * step + comp]);
}
......
......@@ -5,14 +5,18 @@
#include <vector>
#include <stdlib.h>
#include "GmshConfig.h"
#include "GModel.h"
#include "discreteFace.h"
#include "DivideAndConquer.h"
#include "GmshMessage.h"
#include "MVertex.h"
#include "Triangulate.h"
#include "Context.h"
#if defined(HAVE_MESH)
#include "DivideAndConquer.h"
#endif
StringXNumber TriangulateOptions_Number[] = {
{GMSH_FULLRC, "View", NULL, -1.}
};
......@@ -50,8 +54,8 @@ class PointData : public MVertex {
std::vector<double> v;
PointData(double x, double y, double z, int numVal)
: MVertex(x, y, z)
{
v.resize(3 + numVal);
{
v.resize(3 + numVal);
v[0] = x;
v[1] = y;
v[2] = z;
......@@ -70,6 +74,7 @@ static void project(MVertex *v, double mat[3][3])
PView *GMSH_TriangulatePlugin::execute(PView *v)
{
#if defined(HAVE_MESH)
int iView = (int)TriangulateOptions_Number[0].def;
PView *v1 = getView(iView, v);
......@@ -128,7 +133,7 @@ PView *GMSH_TriangulatePlugin::execute(PView *v)
doc.points[i].where.h = points[i]->x() + XX;
doc.points[i].where.v = points[i]->y() + YY;
doc.points[i].adjacent = NULL;
doc.points[i].data = (void*)points[i];
doc.points[i].data = (void*)points[i];
}
// triangulate
......@@ -144,12 +149,12 @@ PView *GMSH_TriangulatePlugin::execute(PView *v)
p[2] = (PointData*)doc.points[doc.triangles[i].c].data;
int numComp = 0;
std::vector<double> *vec = 0;
if((int)p[0]->v.size() == 3 + 9 * numSteps &&
if((int)p[0]->v.size() == 3 + 9 * numSteps &&
(int)p[1]->v.size() == 3 + 9 * numSteps &&
(int)p[2]->v.size() == 3 + 9 * numSteps){
numComp = 9; data2->NbTT++; vec = &data2->TT;
}
else if((int)p[0]->v.size() == 3 + 3 * numSteps &&
else if((int)p[0]->v.size() == 3 + 3 * numSteps &&
(int)p[1]->v.size() == 3 + 3 * numSteps &&
(int)p[2]->v.size() == 3 + 3 * numSteps){
numComp = 3; data2->NbVT++; vec = &data2->VT;
......@@ -162,7 +167,7 @@ PView *GMSH_TriangulatePlugin::execute(PView *v)
for(int nod = 0; nod < 3; nod++) vec->push_back(p[nod]->v[2]);
for(int step = 0; step < numSteps; step++)
for(int nod = 0; nod < 3; nod++)
for(int comp = 0; comp < numComp; comp++)
for(int comp = 0; comp < numComp; comp++)
vec->push_back(p[nod]->v[3 + numComp * step + comp]);
}
......@@ -176,4 +181,8 @@ PView *GMSH_TriangulatePlugin::execute(PView *v)
data2->finalize();
return v2;
#else
Msg::Error("Plugin(Triangulate) requires mesh module");
return v;
#endif
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment