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

fix compile

parent daab710d
No related branches found
No related tags found
No related merge requests found
......@@ -29,7 +29,6 @@
static inline void functionShapes(int p, double Xi[2], double* phi)
{
switch(p){
case 1:
......@@ -48,23 +47,20 @@ static inline void functionShapes(int p, double Xi[2], double* phi)
break;
default:
Msg::Error("(discreteDiskFace) static inline functionShapes, only first and second order available; order %d requested.",p);
Msg::Error("(discreteDiskFace) static inline functionShapes, only first "
"and second order available; order %d requested.", p);
break;
}
}
static inline void derivativeShapes(int p, double Xi[2], double phi[6][2])
{
switch(p){
case 1:
phi[0][0] = -1. ; phi[0][1] = -1.;
phi[1][0] = 1. ; phi[1][1] = 0.;
phi[2][0] = 0. ; phi[2][1] = 1.;
break;
case 2:
......@@ -77,14 +73,14 @@ static inline void derivativeShapes(int p, double Xi[2], double phi[6][2])
break;
default:
Msg::Error("(discreteDiskFace) static inline derivativeShapes, only first and second order available; order %d requested.",p);
Msg::Error("(discreteDiskFace) static inline derivativeShapes, only first and "
"second order available; order %d requested.",p);
break;
}
}
static inline bool uv2xi(discreteDiskFaceTriangle* my_ddft, double U[2], double Xi[2]){
static inline bool uv2xi(discreteDiskFaceTriangle* my_ddft, double U[2], double Xi[2])
{
double M[2][2], R[2];
const SPoint3 p0 = my_ddft->p[0];
const SPoint3 p1 = my_ddft->p[1];
......@@ -142,7 +138,6 @@ static inline bool uv2xi(discreteDiskFaceTriangle* my_ddft, double U[2], double
return true;
}
// The three following things are mandatory to manipulate octrees (octree in (u;v)).
static void discreteDiskFaceBB(void *a, double*mmin, double*mmax)
{
......@@ -178,7 +173,6 @@ static void discreteDiskFaceCentroid(void *a, double*c)
static int discreteDiskFaceInEle(void *a, double*c)// # mark
{
discreteDiskFaceTriangle *t = (discreteDiskFaceTriangle *)a;
double Xi[2];
double U[2] = {c[0],c[1]};
......@@ -191,8 +185,10 @@ static int discreteDiskFaceInEle(void *a, double*c)// # mark
return 0;
}
static bool orderVertices(const double &tot_length, const std::vector<MVertex*> &l, std::vector<double> &coord)
{ // called once by constructor ; organize the vertices for the linear system expressing the mapping
static bool orderVertices(const double &tot_length, const std::vector<MVertex*> &l,
std::vector<double> &coord)
{ // called once by constructor ; organize the vertices for the linear system
// expressing the mapping
coord.clear();
coord.push_back(0.);
......@@ -211,14 +207,12 @@ static bool orderVertices(const double &tot_length, const std::vector<MVertex*>
first = next;
}
return true;
}
/*BUILDER*/
discreteDiskFace::discreteDiskFace(GFace *gf, triangulation* diskTriangulation, int p, std::vector<GFace*> *CAD) :
GFace(gf->model(),123), _parent (gf),_ddft(NULL)
discreteDiskFace::discreteDiskFace(GFace *gf, triangulation* diskTriangulation,
int p, std::vector<GFace*> *CAD) :
GFace(gf->model(),123), _parent (gf), _ddft(NULL), oct(NULL)
{
initialTriangulation = diskTriangulation;
std::vector<MElement*> mesh = diskTriangulation->tri;
......@@ -241,7 +235,8 @@ discreteDiskFace::discreteDiskFace(GFace *gf, triangulation* diskTriangulation,
if (!CAD) vv = new MFaceVertex ( v->x(), v->y(), v->z(), v->onWhat(), 0, 0);
else{
GFace *cad = (*CAD)[i];
if(cad != v->onWhat())Msg::Fatal("Line %d FILE %s : erroneous cad list",__LINE__,__FILE__);
if(cad != v->onWhat())
Msg::Fatal("Line %d FILE %s : erroneous cad list",__LINE__,__FILE__);
double pu,pv; v->getParameter(0,pu);v->getParameter(1,pv);
vv = new MFaceVertex ( v->x(), v->y(), v->z(), v->onWhat(), pu, pv);
}
......@@ -295,7 +290,8 @@ discreteDiskFace::discreteDiskFace(GFace *gf, triangulation* diskTriangulation,
buildOct(CAD);
if (!checkOrientationUV()){
Msg::Info("discreteDIskFace:: parametrization is not one-to-one; fixing the discrete system.");
Msg::Info("discreteDIskFace:: parametrization is not one-to-one; fixing "
"the discrete system.");
parametrize(true);
buildOct(CAD);
}
......@@ -340,7 +336,6 @@ void discreteDiskFace::buildOct(std::vector<GFace*> *CAD) const
Octree_Arrange(oct);
}
bool discreteDiskFace::parametrize(bool one2one) const
{ // #improveme
......@@ -373,15 +368,14 @@ bool discreteDiskFace::parametrize(bool one2one) const
}
}
Msg::Debug("Creating term %d dofs numbered %d fixed",
myAssemblerU.sizeOfR() + myAssemblerV.sizeOfR(), myAssemblerU.sizeOfF() + myAssemblerV.sizeOfF());
myAssemblerU.sizeOfR() + myAssemblerV.sizeOfR(),
myAssemblerU.sizeOfF() + myAssemblerV.sizeOfF());
double t1 = Cpu();
simpleFunction<double> ONE(1.0);
if (one2one){
convexLaplaceTerm mappingU(0, 1, &ONE);
convexLaplaceTerm mappingV(0, 1, &ONE);
......@@ -431,7 +425,6 @@ bool discreteDiskFace::parametrize(bool one2one) const
delete lsys_v;
return true;
}
void discreteDiskFace::getTriangleUV(const double u,const double v,
......@@ -448,9 +441,8 @@ void discreteDiskFace::getTriangleUV(const double u,const double v,
_eta = Xi[1];
}
bool discreteDiskFace::checkOrientationUV(){
bool discreteDiskFace::checkOrientationUV()
{
discreteDiskFaceTriangle *ct;
if(_order==1){
......@@ -550,7 +542,8 @@ SPoint2 discreteDiskFace::parFromVertex(MVertex *v) const
Msg::Fatal("FIXME TO DO %d %s",__LINE__,__FILE__);
}
else if (v->onWhat()->dim()==0)
Msg::Fatal("discreteDiskFace::parFromVertex vertex classified on a model vertex that is not part of the face");
Msg::Fatal("discreteDiskFace::parFromVertex vertex classified on a model "
"vertex that is not part of the face");
return SPoint2(0,0);
}
......@@ -643,25 +636,29 @@ void discreteDiskFace::secondDer(const SPoint2 &param,
return;
}
void discreteDiskFace::putOnView()
{
char mybuffer [64];
snprintf(mybuffer,sizeof(mybuffer),"param_u_part%d_order%d.pos",initialTriangulation->idNum,_order);
snprintf(mybuffer,sizeof(mybuffer),"param_u_part%d_order%d.pos",
initialTriangulation->idNum,_order);
FILE* view_u = Fopen(mybuffer,"w");
snprintf(mybuffer,sizeof(mybuffer),"param_v_part%d_order%d.pos",initialTriangulation->idNum,_order);
snprintf(mybuffer,sizeof(mybuffer),"param_v_part%d_order%d.pos",
initialTriangulation->idNum,_order);
FILE* view_v = Fopen(mybuffer,"w");
snprintf(mybuffer,sizeof(mybuffer),"UVx_part%d_order%d.pos",initialTriangulation->idNum,_order);
snprintf(mybuffer,sizeof(mybuffer),"UVx_part%d_order%d.pos",
initialTriangulation->idNum,_order);
FILE* UVx = Fopen(mybuffer,"w");
snprintf(mybuffer,sizeof(mybuffer),"UVy_part%d_order%d.pos",initialTriangulation->idNum,_order);
snprintf(mybuffer,sizeof(mybuffer),"UVy_part%d_order%d.pos",
initialTriangulation->idNum,_order);
FILE* UVy = Fopen(mybuffer,"w");
snprintf(mybuffer,sizeof(mybuffer),"UVz_part%d_order%d.pos",initialTriangulation->idNum,_order);
snprintf(mybuffer,sizeof(mybuffer),"UVz_part%d_order%d.pos",
initialTriangulation->idNum,_order);
FILE* UVz = Fopen(mybuffer,"w");
if(view_u && view_v && UVx && UVy && UVz){
......@@ -687,14 +684,18 @@ void discreteDiskFace::putOnView()
fprintf(UVz,"ST%d(",_order);
}
for (int j=0; j<_N-1; j++){
fprintf(view_u,"%g,%g,%g,",my_ddft->tri->getVertex(j)->x(),my_ddft->tri->getVertex(j)->y(),my_ddft->tri->getVertex(j)->z());
fprintf(view_v,"%g,%g,%g,",my_ddft->tri->getVertex(j)->x(),my_ddft->tri->getVertex(j)->y(),my_ddft->tri->getVertex(j)->z());
fprintf(view_u,"%g,%g,%g,",my_ddft->tri->getVertex(j)->x(),
my_ddft->tri->getVertex(j)->y(),my_ddft->tri->getVertex(j)->z());
fprintf(view_v,"%g,%g,%g,",my_ddft->tri->getVertex(j)->x(),
my_ddft->tri->getVertex(j)->y(),my_ddft->tri->getVertex(j)->z());
fprintf(UVx,"%g,%g,%g,",my_ddft->p[j].x(),my_ddft->p[j].y(),0.);
fprintf(UVy,"%g,%g,%g,",my_ddft->p[j].x(),my_ddft->p[j].y(),0.);
fprintf(UVz,"%g,%g,%g,",my_ddft->p[j].x(),my_ddft->p[j].y(),0.);
}
fprintf(view_u,"%g,%g,%g){",my_ddft->tri->getVertex(_N-1)->x(),my_ddft->tri->getVertex(_N-1)->y(),my_ddft->tri->getVertex(_N-1)->z());
fprintf(view_v,"%g,%g,%g){",my_ddft->tri->getVertex(_N-1)->x(),my_ddft->tri->getVertex(_N-1)->y(),my_ddft->tri->getVertex(_N-1)->z());
fprintf(view_u,"%g,%g,%g){",my_ddft->tri->getVertex(_N-1)->x(),
my_ddft->tri->getVertex(_N-1)->y(),my_ddft->tri->getVertex(_N-1)->z());
fprintf(view_v,"%g,%g,%g){",my_ddft->tri->getVertex(_N-1)->x(),
my_ddft->tri->getVertex(_N-1)->y(),my_ddft->tri->getVertex(_N-1)->z());
fprintf(UVx,"%g,%g,%g){",my_ddft->p[_N-1].x(),my_ddft->p[_N-1].y(),0.);
fprintf(UVy,"%g,%g,%g){",my_ddft->p[_N-1].x(),my_ddft->p[_N-1].y(),0.);
fprintf(UVz,"%g,%g,%g){",my_ddft->p[_N-1].x(),my_ddft->p[_N-1].y(),0.);
......@@ -745,7 +746,7 @@ void discreteDiskFace::putOnView()
*/
}
// useful for mesh generators ----------------------------------------
// useful for mesh generators
// Intersection of a circle and a plane
GPoint discreteDiskFace::intersectionWithCircle(const SVector3 &n1, const SVector3 &n2,
const SVector3 &p, const double &d,
......@@ -765,9 +766,12 @@ GPoint discreteDiskFace::intersectionWithCircle(const SVector3 &n1, const SVecto
// the point is situated in the half plane defined
// by direction n1 and point p (exclude the one on the
// other side)
SVector3 v0(ct->tri->getVertex(0)->x(),ct->tri->getVertex(0)->y(),ct->tri->getVertex(0)->z());
SVector3 v1(ct->tri->getVertex(1)->x(),ct->tri->getVertex(1)->y(),ct->tri->getVertex(1)->z());
SVector3 v2(ct->tri->getVertex(2)->x(),ct->tri->getVertex(2)->y(),ct->tri->getVertex(2)->z());
SVector3 v0(ct->tri->getVertex(0)->x(),ct->tri->getVertex(0)->y(),
ct->tri->getVertex(0)->z());
SVector3 v1(ct->tri->getVertex(1)->x(),ct->tri->getVertex(1)->y(),
ct->tri->getVertex(1)->z());
SVector3 v2(ct->tri->getVertex(2)->x(),ct->tri->getVertex(2)->y(),
ct->tri->getVertex(2)->z());
SVector3 t1 = v1 - v0;
SVector3 t2 = v2 - v0;
// let us first compute point q to be the intersection
......@@ -849,5 +853,4 @@ GPoint discreteDiskFace::intersectionWithCircle(const SVector3 &n1, const SVecto
return pp;
}
#endif
......@@ -23,28 +23,26 @@
#include "PView.h"
#include "robustPredicates.h"
/*inline utilities*/
inline int nodeLocalNum(MElement* e, MVertex* v) {// const
inline int nodeLocalNum(MElement* e, MVertex* v)
{
for(int i=0; i<e->getNumVertices(); i++)
if (v == e->getVertex(i))
return i;
return -1;
}
inline int edgeLocalNum(MElement* e, MEdge ed) {// const
inline int edgeLocalNum(MElement* e, MEdge ed)
{
for(int i=0; i<e->getNumEdges(); i++)
if (ed == e->getEdge(i))
return i;
return -1;
}
/*various classes*/
class ANNkd_tree;
class Octree;
class GRbf;
class triangulation {
public:
......@@ -52,18 +50,20 @@ class triangulation {
// attributes
std::vector<MElement*> tri;// triangles
std::set<MVertex*> vert;// nodes
std::map<MEdge,std::vector<int>,Less_Edge> ed2tri; // edge to 1 or 2 triangle(s), their num into the vector of MElement*
// edge to 1 or 2 triangle(s), their num into the vector of MElement*
std::map<MEdge,std::vector<int>,Less_Edge> ed2tri;
std::map<double,std::vector<MVertex*> > bord; //border(s)
std::set<MEdge,Less_Edge> borderEdg; // border edges
GFace *gf;
int idNum; // number of identification, for hashing purposes
//methods
int genus(){
int genus()
{
return ( -vert.size() + ed2tri.size() - tri.size() + 2 - bord.size() )/2;
}
void assignVert(){
void assignVert()
{
for(unsigned int i = 0; i < tri.size(); ++i){
MElement* t = tri[i];
for(int j = 0; j < t->getNumVertices() ; j++){
......@@ -74,7 +74,8 @@ class triangulation {
}
}
void assignEd2tri(){
void assignEd2tri()
{
for(unsigned int i = 0; i < tri.size(); ++i){
MElement *t = tri[i];
for(int j = 0; j < 3 ; j++){
......@@ -84,7 +85,8 @@ class triangulation {
}
}
void assignBord(){
void assignBord()
{
for(unsigned int i = 0; i < tri.size(); ++i){
MElement *t = tri[i];
for(int j = 0; j < t->getNumEdges() ; j++){
......@@ -109,7 +111,8 @@ class triangulation {
vecver.erase(vecver.begin());
std::map<MVertex*,std::vector<MVertex*> >::iterator im = firstNode2Edge.find(first);
if (im != firstNode2Edge.end()) Msg::Fatal("Incorrect topology in discreteDiskFace %d", gf->tag());
if (im != firstNode2Edge.end())
Msg::Error("Incorrect topology in discreteDiskFace %d", gf->tag());
firstNode2Edge[first] = vecver;
firstNode2Edge[first].push_back(last);
}
......@@ -121,15 +124,10 @@ class triangulation {
std::map<MVertex*,std::vector<MVertex*> >::iterator in = firstNode2Edge.begin();
MVertex* previous = in->first;
while(in != firstNode2Edge.end()) { // it didn't find it
std::vector<MVertex*> myV = in->second;
for(unsigned int i=0; i<myV.size(); i++){
loop.push_back(previous);
MVertex* current = myV[i];
length += sqrt( (current->x()-previous->x()) * (current->x()-previous->x()) +
(current->y()-previous->y()) * (current->y()-previous->y()) +
(current->z()-previous->z()) * (current->z()-previous->z()) );
......@@ -139,22 +137,24 @@ class triangulation {
firstNode2Edge.erase(in);
in = firstNode2Edge.find(previous);
}// end while in
bord.insert(std::make_pair(length,loop)); // it shouldn't be possible to have twice the same length ? actually, it is possible, but quite seldom #fixme ----> multimap ?
bord.insert(std::make_pair(length,loop));
// it shouldn't be possible to have twice the same length ? actually, it
// is possible, but quite seldom #fixme ----> multimap ?
} // end while firstNode2Edge
}// end method
void assign(){
void assign()
{
assignVert();
assignEd2tri();
assignBord();
}
//builder
triangulation() : gf(0) {}
triangulation(std::vector<MElement*> input, GFace* gface) : tri(input), gf(gface) {assign();}
triangulation(std::vector<MElement*> input, GFace* gface)
: tri(input), gf(gface) { assign(); }
};
// --------------------
// triangles in the physical space xyz, with their parametric coordinates
class discreteDiskFaceTriangle {
public:
......@@ -165,8 +165,6 @@ class discreteDiskFaceTriangle {
discreteDiskFaceTriangle() : gf(0), tri(0) {}
};
// --------------------
class discreteDiskFace : public GFace {
GFace *_parent;
void buildOct(std::vector<GFace*> *CAD = NULL) const;
......@@ -175,9 +173,11 @@ class discreteDiskFace : public GFace {
bool checkOrientationUV();
public:
discreteDiskFace(GFace *parent, triangulation* diskTriangulation, int p=1, std::vector<GFace*> *CAD = NULL);// BUILDER
discreteDiskFace(GFace *parent, triangulation* diskTriangulation,
int p=1, std::vector<GFace*> *CAD = NULL);
virtual ~discreteDiskFace();
void getTriangleUV(const double u,const double v,discreteDiskFaceTriangle **mt, double &_u, double &_v) const;
void getTriangleUV(const double u,const double v,discreteDiskFaceTriangle **mt,
double &_u, double &_v) const;
GPoint point(double par1, double par2) const;
SPoint2 parFromVertex(MVertex *v) const;
SVector3 normal(const SPoint2&) const;
......@@ -191,15 +191,12 @@ class discreteDiskFace : public GFace {
const SVector3 &p, const double &d,
double uv[2]) const;
protected:
//------------------------------------------------
// a copy of the mesh that should not be destroyed
triangulation* initialTriangulation;
triangulation* geoTriangulation;// parametrized triangulation
std::vector<MElement*> discrete_triangles;
std::vector<MVertex*> discrete_vertices;
//------------------------------------------------
//-----------------------------------------------
int _order;
int _N;// number of dof's for a triangle
double _totLength;
......@@ -211,7 +208,7 @@ class discreteDiskFace : public GFace {
mutable v2t_cont adjv;
mutable std::map<MVertex*, Pair<SVector3,SVector3> > firstDerivatives;
mutable discreteDiskFaceTriangle *_ddft;
mutable Octree *oct = NULL;
mutable Octree *oct;
mutable std::vector<double> _coords;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment