Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
f4e613f8
Commit
f4e613f8
authored
13 years ago
by
Amaury Johnen
Browse files
Options
Downloads
Patches
Plain Diff
corr bug orientation
parent
0b6c1eb0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Mesh/meshGFaceRecombine.cpp
+50
-7
50 additions, 7 deletions
Mesh/meshGFaceRecombine.cpp
Mesh/meshGFaceRecombine.h
+9
-1
9 additions, 1 deletion
Mesh/meshGFaceRecombine.h
with
59 additions
and
8 deletions
Mesh/meshGFaceRecombine.cpp
+
50
−
7
View file @
f4e613f8
...
@@ -269,7 +269,7 @@ double Recombine2D::recombine(int depth)
...
@@ -269,7 +269,7 @@ double Recombine2D::recombine(int depth)
while
(
currentNode
)
{
while
(
currentNode
)
{
FlGui
::
instance
()
->
check
();
FlGui
::
instance
()
->
check
();
#ifdef REC2D_DRAW // draw state at origin
#if
0//
def REC2D_DRAW // draw state at origin
_gf->triangles = _data->_tri;
_gf->triangles = _data->_tri;
_gf->quadrangles = _data->_quad;
_gf->quadrangles = _data->_quad;
CTX::instance()->mesh.changed = ENT_ALL;
CTX::instance()->mesh.changed = ENT_ALL;
...
@@ -301,6 +301,11 @@ double Recombine2D::recombine(int depth)
...
@@ -301,6 +301,11 @@ double Recombine2D::recombine(int depth)
//_data->printState();
//_data->printState();
}
}
int
Recombine2D
::
getNumTri
()
const
{
return
_data
->
getNumTri
();
}
void
Recombine2D
::
clearChanges
()
void
Recombine2D
::
clearChanges
()
{
{
Rec2DData
::
clearChanges
();
Rec2DData
::
clearChanges
();
...
@@ -776,6 +781,7 @@ void Rec2DData::printActions() const
...
@@ -776,6 +781,7 @@ void Rec2DData::printActions() const
data
[
tri
[
1
]
->
getNum
()].
resize
(
1
);
data
[
tri
[
1
]
->
getNum
()].
resize
(
1
);
data
[
tri
[
0
]
->
getNum
()][
0
]
=
(
*
it
)
->
getReward
();
data
[
tri
[
0
]
->
getNum
()][
0
]
=
(
*
it
)
->
getReward
();
data
[
tri
[
1
]
->
getNum
()][
0
]
=
(
*
it
)
->
getReward
();
data
[
tri
[
1
]
->
getNum
()][
0
]
=
(
*
it
)
->
getReward
();
//(*it)->print();
}
}
new
PView
(
"Jmin_bad"
,
"ElementData"
,
Recombine2D
::
getGFace
()
->
model
(),
data
);
new
PView
(
"Jmin_bad"
,
"ElementData"
,
Recombine2D
::
getGFace
()
->
model
(),
data
);
Msg
::
Info
(
" "
);
Msg
::
Info
(
" "
);
...
@@ -1010,14 +1016,14 @@ void Rec2DData::revertAssumedParities()
...
@@ -1010,14 +1016,14 @@ void Rec2DData::revertAssumedParities()
double
Rec2DData
::
getGlobalQuality
()
double
Rec2DData
::
getGlobalQuality
()
{
{
double
a
=
(
double
)
_current
->
_valVert
/
(
double
)
_current
->
_numVert
;
double
a
=
(
double
)
_current
->
_valVert
/
(
double
)
_current
->
_numVert
;
return
a
*
a
*
(
double
)
_current
->
_valEdge
/
(
double
)
_current
->
_numEdge
;
return
a
*
(
double
)
_current
->
_valEdge
/
(
double
)
_current
->
_numEdge
;
}
}
double
Rec2DData
::
getGlobalQuality
(
int
numEdge
,
double
valEdge
,
double
Rec2DData
::
getGlobalQuality
(
int
numEdge
,
double
valEdge
,
int
numVert
,
double
valVert
)
int
numVert
,
double
valVert
)
{
{
double
a
=
((
double
)
_current
->
_valVert
+
valVert
)
/
(
double
)(
_current
->
_numVert
+
numVert
);
double
a
=
((
double
)
_current
->
_valVert
+
valVert
)
/
(
double
)(
_current
->
_numVert
+
numVert
);
return
a
*
a
*
((
double
)
_current
->
_valEdge
+
valEdge
)
/
(
double
)(
_current
->
_numEdge
+
numEdge
);
return
a
*
((
double
)
_current
->
_valEdge
+
valEdge
)
/
(
double
)(
_current
->
_numEdge
+
numEdge
);
}
}
Rec2DAction
*
Rec2DData
::
getBestAction
()
Rec2DAction
*
Rec2DData
::
getBestAction
()
...
@@ -1289,6 +1295,21 @@ void Rec2DTwoTri2Quad::reveal()
...
@@ -1289,6 +1295,21 @@ void Rec2DTwoTri2Quad::reveal()
Rec2DData
::
add
(
this
);
Rec2DData
::
add
(
this
);
}
}
//void Rec2DTwoTri2Quad::print()
//{
// Msg::Info("Printing Action %d |%d|%d|...", this, _triangles[0]->getNum(), _triangles[1]->getNum());
// Msg::Info("edge0 %g (%g, %g)", _edges[0]->getQual(), _edges[0]->getQualL(), _edges[0]->getQualO());
// Msg::Info("edge1 %g (%g, %g)", _edges[1]->getQual(), _edges[1]->getQualL(), _edges[1]->getQualO());
// Msg::Info("edge2 %g (%g, %g)", _edges[2]->getQual(), _edges[2]->getQualL(), _edges[2]->getQualO());
// Msg::Info("edge3 %g (%g, %g)", _edges[3]->getQual(), _edges[3]->getQualL(), _edges[3]->getQualO());
// Msg::Info("edge4 %g (%g, %g)", _edges[4]->getQual(), _edges[4]->getQualL(), _edges[4]->getQualO());
// Msg::Info("angles %g - %g", _vertices[0]->getAngle(), _vertices[1]->getAngle());
// Msg::Info("merge0 %g", _vertices[0]->getGainMerge(_triangles[0], _triangles[1]));
// Msg::Info("merge1 %g", _vertices[1]->getGainMerge(_triangles[0], _triangles[1]));
// //_vertices[0]->printGainMerge(_triangles[0], _triangles[1]);
// //_vertices[1]->printGainMerge(_triangles[0], _triangles[1]);
//}
void
Rec2DTwoTri2Quad
::
_computeGlobQual
()
void
Rec2DTwoTri2Quad
::
_computeGlobQual
()
{
{
double
valEdge
=
-
(
double
)
REC2D_EDGE_BASE
*
_edges
[
4
]
->
getQual
();
double
valEdge
=
-
(
double
)
REC2D_EDGE_BASE
*
_edges
[
4
]
->
getQual
();
...
@@ -1582,10 +1603,10 @@ void Rec2DEdge::reveal()
...
@@ -1582,10 +1603,10 @@ void Rec2DEdge::reveal()
Rec2DData
::
addEdge
(
_weight
,
getWeightedQual
());
Rec2DData
::
addEdge
(
_weight
,
getWeightedQual
());
}
}
void
Rec2DEdge
::
_computeQual
()
//*
void
Rec2DEdge
::
_computeQual
()
{
{
double
adimLength
=
_straightAdimLength
();
double
alignment
=
_straightAlignment
();
double
alignment
=
_straightAlignment
();
double
adimLength
=
_straightAdimLength
();
if
(
adimLength
>
1
)
if
(
adimLength
>
1
)
adimLength
=
1.
/
adimLength
;
adimLength
=
1.
/
adimLength
;
_qual
=
adimLength
*
((
double
)(
1
-
REC2D_ALIGNMENT
)
+
(
double
)
REC2D_ALIGNMENT
*
alignment
);
_qual
=
adimLength
*
((
double
)(
1
-
REC2D_ALIGNMENT
)
+
(
double
)
REC2D_ALIGNMENT
*
alignment
);
...
@@ -1601,6 +1622,22 @@ double Rec2DEdge::getQual() const
...
@@ -1601,6 +1622,22 @@ double Rec2DEdge::getQual() const
return
_qual
;
return
_qual
;
}
}
//double Rec2DEdge::getQualL() const
//{
// double adimLength = _straightAdimLength();
// if (adimLength > 1)
// ;//adimLength = 1./adimLength;
// return adimLength;
//}
//
//double Rec2DEdge::getQualO() const
//{
// Msg::Info("o (%g %g) %g", Recombine2D::bgm()->getAngle(_rv0->u(), _rv0->v(), .0)
// , Recombine2D::bgm()->getAngle(_rv1->u(), _rv1->v(), .0)
// , atan2(_rv0->u()-_rv1->u(), _rv0->v()-_rv1->v()));
// return _straightAlignment();
//}
//
double
Rec2DEdge
::
getWeightedQual
()
const
double
Rec2DEdge
::
getWeightedQual
()
const
{
{
if
(
_weight
!=
.0
&&
if
(
_weight
!=
.0
&&
...
@@ -1670,7 +1707,7 @@ double Rec2DEdge::_straightAlignment() const
...
@@ -1670,7 +1707,7 @@ double Rec2DEdge::_straightAlignment() const
{
{
double
angle0
=
Recombine2D
::
bgm
()
->
getAngle
(
_rv0
->
u
(),
_rv0
->
v
(),
.0
);
double
angle0
=
Recombine2D
::
bgm
()
->
getAngle
(
_rv0
->
u
(),
_rv0
->
v
(),
.0
);
double
angle1
=
Recombine2D
::
bgm
()
->
getAngle
(
_rv1
->
u
(),
_rv1
->
v
(),
.0
);
double
angle1
=
Recombine2D
::
bgm
()
->
getAngle
(
_rv1
->
u
(),
_rv1
->
v
(),
.0
);
double
angleEdge
=
atan2
(
_rv0
->
u
()
-
_rv1
->
u
(),
_rv0
->
v
()
-
_rv1
->
v
());
double
angleEdge
=
atan2
(
_rv0
->
v
()
-
_rv1
->
v
(),
_rv0
->
u
()
-
_rv1
->
u
());
double
alpha0
=
angleEdge
-
angle0
;
double
alpha0
=
angleEdge
-
angle0
;
double
alpha1
=
angleEdge
-
angle1
;
double
alpha1
=
angleEdge
-
angle1
;
...
@@ -1707,6 +1744,7 @@ Rec2DVertex::Rec2DVertex(MVertex *v)
...
@@ -1707,6 +1744,7 @@ Rec2DVertex::Rec2DVertex(MVertex *v)
#ifdef REC2D_DRAW
#ifdef REC2D_DRAW
if
(
_v
)
if
(
_v
)
_v
->
setIndex
(
_parity
);
_v
->
setIndex
(
_parity
);
//_v->setIndex(_onWhat);
#endif
#endif
}
}
...
@@ -1729,6 +1767,7 @@ Rec2DVertex::Rec2DVertex(Rec2DVertex *rv, double ang)
...
@@ -1729,6 +1767,7 @@ Rec2DVertex::Rec2DVertex(Rec2DVertex *rv, double ang)
#ifdef REC2D_DRAW
#ifdef REC2D_DRAW
if
(
_v
)
if
(
_v
)
_v
->
setIndex
(
_parity
);
_v
->
setIndex
(
_parity
);
//_v->setIndex(_onWhat);
#endif
#endif
}
}
...
@@ -1877,7 +1916,8 @@ void Rec2DVertex::setParity(int p, bool tree)
...
@@ -1877,7 +1916,8 @@ void Rec2DVertex::setParity(int p, bool tree)
Rec2DData
::
addParity
(
this
,
_parity
);
Rec2DData
::
addParity
(
this
,
_parity
);
#ifdef REC2D_DRAW
#ifdef REC2D_DRAW
if
(
_v
)
if
(
_v
)
_v
->
setIndex
(
_parity
);
//_v->setIndex(_parity);
_v
->
setIndex
(
_onWhat
);
#endif
#endif
}
}
...
@@ -1896,6 +1936,7 @@ void Rec2DVertex::setParityWD(int pOld, int pNew)
...
@@ -1896,6 +1936,7 @@ void Rec2DVertex::setParityWD(int pOld, int pNew)
#ifdef REC2D_DRAW
#ifdef REC2D_DRAW
if
(
_v
)
if
(
_v
)
_v
->
setIndex
(
_parity
);
_v
->
setIndex
(
_parity
);
//_v->setIndex(_onWhat);
#endif
#endif
}
}
...
@@ -1926,6 +1967,7 @@ bool Rec2DVertex::setAssumedParity(int p)
...
@@ -1926,6 +1967,7 @@ bool Rec2DVertex::setAssumedParity(int p)
#ifdef REC2D_DRAW
#ifdef REC2D_DRAW
if
(
_v
)
if
(
_v
)
_v
->
setIndex
(
_assumedParity
);
_v
->
setIndex
(
_assumedParity
);
//_v->setIndex(_onWhat);
#endif
#endif
return
true
;
return
true
;
}
}
...
@@ -2674,6 +2716,7 @@ bool Rec2DNode::makeChanges()
...
@@ -2674,6 +2716,7 @@ bool Rec2DNode::makeChanges()
return
false
;
return
false
;
_dataChange
=
Rec2DData
::
getNewDataChange
();
_dataChange
=
Rec2DData
::
getNewDataChange
();
_ra
->
apply
(
_dataChange
);
_ra
->
apply
(
_dataChange
);
Rec2DData
::
setNumTri
(
_remainingTri
);
return
true
;
return
true
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Mesh/meshGFaceRecombine.h
+
9
−
1
View file @
f4e613f8
...
@@ -62,6 +62,7 @@ class Recombine2D {
...
@@ -62,6 +62,7 @@ class Recombine2D {
bool
recombine
();
bool
recombine
();
double
recombine
(
int
depth
);
double
recombine
(
int
depth
);
bool
developTree
();
bool
developTree
();
int
getNumTri
()
const
;
static
void
nextTreeActions
(
std
::
vector
<
Rec2DAction
*>&
,
static
void
nextTreeActions
(
std
::
vector
<
Rec2DAction
*>&
,
const
std
::
vector
<
Rec2DElement
*>
&
neighbours
);
const
std
::
vector
<
Rec2DElement
*>
&
neighbours
);
...
@@ -91,6 +92,7 @@ class Rec2DData {
...
@@ -91,6 +92,7 @@ class Rec2DData {
int
_numEdge
,
_numVert
;
int
_numEdge
,
_numVert
;
long
double
_valEdge
,
_valVert
;
long
double
_valEdge
,
_valVert
;
static
Rec2DData
*
_current
;
static
Rec2DData
*
_current
;
int
_remainingTri
;
std
::
set
<
Rec2DEdge
*>
_edges
;
std
::
set
<
Rec2DEdge
*>
_edges
;
std
::
set
<
Rec2DVertex
*>
_vertices
;
std
::
set
<
Rec2DVertex
*>
_vertices
;
...
@@ -117,7 +119,9 @@ class Rec2DData {
...
@@ -117,7 +119,9 @@ class Rec2DData {
std
::
vector
<
MTriangle
*>
_tri
;
std
::
vector
<
MTriangle
*>
_tri
;
std
::
vector
<
MQuadrangle
*>
_quad
;
std
::
vector
<
MQuadrangle
*>
_quad
;
#endif
#endif
static
inline
int
getNumTri
()
{
return
_current
->
_remainingTri
;}
static
inline
void
setNumTri
(
int
n
)
{
_current
->
_remainingTri
=
n
;}
static
inline
int
getNumEndNode
()
{
return
_current
->
_endNodes
.
size
();}
static
inline
int
getNumEndNode
()
{
return
_current
->
_endNodes
.
size
();}
static
inline
int
getNumElement
()
{
return
_current
->
_elements
.
size
();}
static
inline
int
getNumElement
()
{
return
_current
->
_elements
.
size
();}
static
Rec2DDataChange
*
getNewDataChange
();
static
Rec2DDataChange
*
getNewDataChange
();
...
@@ -257,6 +261,7 @@ class Rec2DAction {
...
@@ -257,6 +261,7 @@ class Rec2DAction {
virtual
void
getNeighbourElements
(
std
::
vector
<
Rec2DElement
*>&
)
const
=
0
;
virtual
void
getNeighbourElements
(
std
::
vector
<
Rec2DElement
*>&
)
const
=
0
;
virtual
int
getNum
(
double
shiftx
,
double
shifty
)
=
0
;
virtual
int
getNum
(
double
shiftx
,
double
shifty
)
=
0
;
virtual
Rec2DElement
*
getRandomElement
()
const
=
0
;
virtual
Rec2DElement
*
getRandomElement
()
const
=
0
;
//virtual void print() = 0;
private
:
private
:
virtual
void
_computeGlobQual
()
=
0
;
virtual
void
_computeGlobQual
()
=
0
;
...
@@ -290,6 +295,7 @@ class Rec2DTwoTri2Quad : public Rec2DAction {
...
@@ -290,6 +295,7 @@ class Rec2DTwoTri2Quad : public Rec2DAction {
virtual
void
getNeighbourElements
(
std
::
vector
<
Rec2DElement
*>&
)
const
;
virtual
void
getNeighbourElements
(
std
::
vector
<
Rec2DElement
*>&
)
const
;
virtual
int
getNum
(
double
shiftx
,
double
shifty
);
virtual
int
getNum
(
double
shiftx
,
double
shifty
);
virtual
Rec2DElement
*
getRandomElement
()
const
;
virtual
Rec2DElement
*
getRandomElement
()
const
;
//virtual void print();
private
:
private
:
virtual
void
_computeGlobQual
();
virtual
void
_computeGlobQual
();
...
@@ -310,6 +316,8 @@ class Rec2DEdge {
...
@@ -310,6 +316,8 @@ class Rec2DEdge {
void
reveal
();
void
reveal
();
double
getQual
()
const
;
double
getQual
()
const
;
//double getQualL() const;
//double getQualO() const;
double
getWeightedQual
()
const
;
double
getWeightedQual
()
const
;
inline
void
addHasTri
()
{
_addWeight
(
-
REC2D_EDGE_QUAD
);
++
_boundary
;}
inline
void
addHasTri
()
{
_addWeight
(
-
REC2D_EDGE_QUAD
);
++
_boundary
;}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment