Skip to content
Snippets Groups Projects
Commit f5b604c3 authored by Jean-François Remacle's avatar Jean-François Remacle
Browse files

*** empty log message ***

parent 184b8307
No related branches found
No related tags found
No related merge requests found
...@@ -12,10 +12,11 @@ GEdgeCompound::GEdgeCompound(GModel *m, int tag, std::vector<GEdge*> &compound) ...@@ -12,10 +12,11 @@ GEdgeCompound::GEdgeCompound(GModel *m, int tag, std::vector<GEdge*> &compound)
{ {
orderEdges (); orderEdges ();
int N = _compound.size(); int N = _compound.size();
v0 = _orientation[0] ? _compound[0]->getBeginVertex() : _compound[0]->getEndVertex(); v0 = _orientation[0] ? _compound[0]->getBeginVertex() : _compound[0]->getEndVertex();
v1 = _orientation[N-1] ? _compound[N-1]->getEndVertex() : _compound[N-1]->getBeginVertex(); v1 = _orientation[N-1] ? _compound[N-1]->getEndVertex() : _compound[N-1]->getBeginVertex();
v0->addEdge(this); v0->addEdge(this);
v1->addEdge(this); v1->addEdge(this);
// printf("%d -> %d\n",v0->tag(),v1->tag());
parametrize(); parametrize();
} }
...@@ -56,6 +57,22 @@ void GEdgeCompound::orderEdges() ...@@ -56,6 +57,22 @@ void GEdgeCompound::orderEdges()
} }
} }
_compound = _c; _compound = _c;
if (_compound.size() < 2)return;
if ( _compound[0]->getEndVertex() != _compound[1]->getEndVertex()
&& _compound[0]->getEndVertex() != _compound[1]->getBeginVertex()){
for (int i=0;i<_compound.size();i++){
_orientation[i] = !_orientation[i] ;
}
}
// for (int i=0;i<_compound.size();i++){
// printf("o %d e %d (%d,%d)\n",
// (int)_orientation[i],
// _compound[i]->tag(),
// _compound[i]->getBeginVertex()->tag(),
// _compound[i]->getEndVertex()->tag());
// }
} }
int GEdgeCompound::minimumMeshSegments() const{ int GEdgeCompound::minimumMeshSegments() const{
...@@ -75,7 +92,7 @@ GEdgeCompound::~GEdgeCompound() ...@@ -75,7 +92,7 @@ GEdgeCompound::~GEdgeCompound()
} }
Range<double> GEdgeCompound::parBounds(int i) const { Range<double> GEdgeCompound::parBounds(int i) const {
return Range<double>(0, _pars[_compound.size()-1]); return Range<double>(0, _pars[_compound.size()]);
} }
/* /*
...@@ -90,8 +107,14 @@ void GEdgeCompound::getLocalParameter ( const double &t, ...@@ -90,8 +107,14 @@ void GEdgeCompound::getLocalParameter ( const double &t,
{ {
for (iEdge=0 ; iEdge<_compound.size() ;iEdge++){ for (iEdge=0 ; iEdge<_compound.size() ;iEdge++){
// printf("iEdge %d par %g\n",iEdge,_pars[iEdge]); // printf("iEdge %d par %g\n",iEdge,_pars[iEdge]);
if (t <= _pars[iEdge]){ double tmin = _pars[iEdge];
tLoc = _orientation[iEdge] ? t - _pars[iEdge] : _pars[iEdge+1] - t; double tmax = _pars[iEdge+1];
if (t >= tmin && t <= tmax){
Range<double> b = _compound[iEdge]->parBounds(0);
tLoc = _orientation[iEdge] ?
b.low() + (t-tmin)/(tmax-tmin) * (b.high()-b.low()) :
b.high() - (t-tmin)/(tmax-tmin) * (b.high()-b.low()) ;
// printf("%g %g %d\n",t,tLoc,iEdge);
return; return;
} }
} }
...@@ -99,10 +122,10 @@ void GEdgeCompound::getLocalParameter ( const double &t, ...@@ -99,10 +122,10 @@ void GEdgeCompound::getLocalParameter ( const double &t,
void GEdgeCompound::parametrize() void GEdgeCompound::parametrize()
{ {
_pars.push_back(0.0);
for (int i=0;i<_compound.size();i++){ for (int i=0;i<_compound.size();i++){
Range<double> b = _compound[i]->parBounds(0); Range<double> b = _compound[i]->parBounds(0);
if (!i)_pars.push_back(b.high() - b.low()); _pars.push_back(_pars[_pars.size()-1]+(b.high() - b.low()));
else _pars.push_back(_pars[i-1]+(b.high() - b.low()));
} }
} }
......
...@@ -32,7 +32,7 @@ class SMetric3 { ...@@ -32,7 +32,7 @@ class SMetric3 {
} }
// default constructor, identity // default constructor, identity
SMetric3(const double v = 1.0){ SMetric3(const double v = 1.0){
_val[0] = _val[2] = _val[5] = v; _val[0] = _val[2] = _val[5] = 1./(v*v);
_val[1] = _val[3] = _val[4] = 0.0; _val[1] = _val[3] = _val[4] = 0.0;
} }
SMetric3(const double l1, SMetric3(const double l1,
......
...@@ -174,7 +174,7 @@ double BGM_MeshSize(GEntity *ge, double U, double V, ...@@ -174,7 +174,7 @@ double BGM_MeshSize(GEntity *ge, double U, double V,
} }
// anisotropic version // anisotropic version of the background field
SMetric3 BGM_MeshMetric(GEntity *ge, SMetric3 BGM_MeshMetric(GEntity *ge,
double U, double V, double U, double V,
double X, double Y, double Z) double X, double Y, double Z)
...@@ -182,7 +182,7 @@ SMetric3 BGM_MeshMetric(GEntity *ge, ...@@ -182,7 +182,7 @@ SMetric3 BGM_MeshMetric(GEntity *ge,
// default lc (mesh size == size of the model) // default lc (mesh size == size of the model)
SMetric3 l1(CTX::instance()->lc); SMetric3 l1(CTX::instance()->lc);
// lc from points // lc from points
SMetric3 l2(MAX_LC); SMetric3 l2(MAX_LC);
if(CTX::instance()->mesh.lcFromPoints && ge->dim() < 2) if(CTX::instance()->mesh.lcFromPoints && ge->dim() < 2)
l2 = SMetric3(LC_MVertex_PNTS(ge, U, V)); l2 = SMetric3(LC_MVertex_PNTS(ge, U, V));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment