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
86c13536
Commit
86c13536
authored
13 years ago
by
Amaury Johnen
Browse files
Options
Downloads
Patches
Plain Diff
No commit message
No commit message
parent
43e91728
No related branches found
No related tags found
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Mesh/meshRecombine2D.cpp
+3
-3
3 additions, 3 deletions
Mesh/meshRecombine2D.cpp
Mesh/meshRecombine2D.h
+212
-15
212 additions, 15 deletions
Mesh/meshRecombine2D.h
Mesh/meshRecombine2D_2.cpp
+508
-91
508 additions, 91 deletions
Mesh/meshRecombine2D_2.cpp
with
723 additions
and
109 deletions
Mesh/meshRecombine2D.cpp
+
3
−
3
View file @
86c13536
...
...
@@ -326,9 +326,9 @@ int Recombine2D::apply()
_gf
->
quadrangles
=
_quads
;
_applied
=
true
;
_gf
->
model
()
->
writeMSH
(
"recSquare.msh"
);
laplaceSmoothing
(
_gf
,
10
0
);
_gf
->
model
()
->
writeMSH
(
"aftSquare.msh"
);
//
_gf->model()->writeMSH("recSquare.msh");
laplaceSmoothing
(
_gf
,
10
);
//
_gf->model()->writeMSH("aftSquare.msh");
return
1
;
}
...
...
This diff is collapsed.
Click to expand it.
Mesh/meshRecombine2D.h
+
212
−
15
View file @
86c13536
...
...
@@ -22,16 +22,184 @@ class RecombTriangle;
class
Recomb2D_Node
;
class
TrianglesUnion
;
class
Rec2d_vertex
;
class
list_actions
;
class
Recombine2D
;
//class list_actions;
//class list_actions::iterator;
struct
lessRecombTri
{
bool
operator
()(
RecombTriangle
*
rt1
,
RecombTriangle
*
rt2
)
const
;
};
struct
lessTriUnion
{
bool
operator
()(
TrianglesUnion
*
,
TrianglesUnion
*
)
const
;
};
struct
lessTriUnionInv
{
bool
operator
()(
TrianglesUnion
*
,
TrianglesUnion
*
)
const
;
};
typedef
std
::
set
<
RecombTriangle
*
,
lessRecombTri
>
Set_Recomb
;
typedef
std
::
map
<
MElement
*
,
std
::
set
<
RecombTriangle
*>
>
Map_Tri_Recomb
;
typedef
std
::
map
<
MElement
*
,
Recomb2D_Node
*>
Map_Tri_Node
;
typedef
std
::
map
<
MTriangle
*
,
std
::
set
<
TrianglesUnion
*>
>
mapTriUnion
;
typedef
std
::
set
<
TrianglesUnion
*
,
lessTriUnionInv
>
setTriUnion
;
typedef
std
::
vector
<
setTriUnion
>
vectSetTriUnion
;
class
list_actions
{
private
:
vectSetTriUnion
_cont
;
public
:
list_actions
(
int
h
)
{
_cont
.
reserve
(
h
);}
class
iterator
{
private
:
int
pos
;
list_actions
*
la
;
setTriUnion
::
iterator
it
;
public
:
void
print
()
{
Msg
::
Info
(
"iterator(pos %d, la %d, tu %d)"
,
pos
,
la
,
*
it
);
}
iterator
(
list_actions
*
l
,
int
i
,
setTriUnion
::
iterator
t
)
{
pos
=
i
;
la
=
l
;
it
=
t
;
}
iterator
()
{
pos
=
-
1
;
}
bool
operator
==
(
iterator
a
)
const
{
if
(
pos
!=
a
.
pos
)
return
false
;
if
(
pos
<
0
)
return
true
;
return
it
==
a
.
it
;
}
bool
operator
!=
(
iterator
a
)
const
{
if
(
pos
!=
a
.
pos
)
return
true
;
if
(
pos
<
0
)
return
false
;
return
it
!=
a
.
it
;
}
iterator
&
operator
=
(
const
iterator
&
a
)
{
if
(
this
!=
&
a
)
{
pos
=
a
.
pos
;
la
=
a
.
la
;
it
=
a
.
it
;
}
return
*
this
;
}
TrianglesUnion
*
operator
*
()
const
{
//Msg::Info("pos %d", pos);
//Msg::Info(" ");
if
(
pos
<
0
)
return
NULL
;
return
*
it
;
}
iterator
&
operator
++
()
{
int
p
=
pos
;
++
it
;
while
(
it
==
la
->
_end
(
p
)
&&
++
p
!=
la
->
_size
())
{
++
pos
;
it
=
la
->
_begin
(
pos
);
if
(
p
!=
pos
)
Msg
::
Error
(
" "
);
}
return
*
this
;
}
iterator
operator
++
(
int
n
)
{
iterator
t
=
*
this
;
int
p
=
pos
;
++
it
;
while
(
it
==
la
->
_end
(
p
)
&&
++
p
!=
la
->
_size
())
{
++
pos
;
it
=
la
->
_begin
(
pos
);
}
return
t
;
}
inline
int
getPos
()
{
return
pos
;}
};
int
add
(
setTriUnion
&
s
)
{
setTriUnion
::
iterator
it
=
s
.
begin
();
while
(
it
!=
s
.
end
())
{
if
(
find
(
*
it
)
!=
end
())
s
.
erase
(
it
++
);
else
++
it
;
}
_cont
.
push_back
(
s
);
return
_cont
.
size
()
-
1
;
}
void
remove
(
int
a
)
{
for
(;
a
<
_cont
.
size
();
a
++
)
_cont
.
pop_back
();
}
iterator
find
(
TrianglesUnion
*
tu
)
{
if
(
_cont
.
empty
())
return
end
();
for
(
int
i
=
0
;
i
<
_cont
.
size
();
++
i
)
{
setTriUnion
::
iterator
it
=
_cont
[
i
].
find
(
tu
);
if
(
it
!=
_cont
[
i
].
end
())
return
iterator
(
this
,
i
,
it
);
}
return
end
();
}
iterator
begin
()
{
if
(
_cont
.
empty
())
return
iterator
(
this
,
-
1
,
_begin
());
return
iterator
(
this
,
0
,
_begin
());
}
iterator
end
()
{
return
iterator
(
this
,
_cont
.
size
()
-
1
,
_end
());
}
void
pop_back
()
{
_cont
.
pop_back
();
}
void
sizes
(){
switch
(
_cont
.
size
())
{
case
3
:
Msg
::
Info
(
"--Actions : %d + %d + %d"
,
_cont
[
0
].
size
(),
_cont
[
1
].
size
(),
_cont
[
2
].
size
());
break
;
case
2
:
Msg
::
Info
(
"--Actions : %d + %d"
,
_cont
[
0
].
size
(),
_cont
[
1
].
size
());
break
;
case
1
:
Msg
::
Info
(
"--Actions : %d"
,
_cont
[
0
].
size
());
break
;
default
:
break
;
}
//Msg::Info("%d sets", _cont.size());
//for (int i = 0; i < _cont.size(); ++i)
// Msg::Info("[%d] %d", i+1, _cont[i].size());
}
private
:
setTriUnion
::
iterator
_end
(
int
pos
=
-
1
)
{
if
(
_cont
.
size
()
==
0
)
{
setTriUnion
::
iterator
it
;
return
it
;
// Not clean !
}
if
(
pos
<
0
)
return
_cont
.
back
().
end
();
return
_cont
[
pos
].
end
();
}
setTriUnion
::
iterator
_begin
(
int
pos
=
-
1
)
{
if
(
_cont
.
size
()
==
0
)
{
setTriUnion
::
iterator
it
;
return
it
;
// Not clean !
}
if
(
pos
<
0
)
return
_cont
.
front
().
begin
();
return
_cont
[
pos
].
begin
();
}
inline
int
_size
()
{
return
_cont
.
size
();}
};
class
Recombine2D
{
private
:
...
...
@@ -43,6 +211,7 @@ class Recombine2D {
Map_Tri_Recomb
_possibleRecomb
;
std
::
set
<
MElement
*>
_isolated
;
std
::
vector
<
MQuadrangle
*>
_quads
;
static
int
ra
;
template
<
class
E
>
void
_buildEdgeToElement
(
std
::
vector
<
E
*>
&
,
e2t_cont
&
);
...
...
@@ -57,15 +226,27 @@ class Recombine2D {
~
Recombine2D
();
int
apply
();
int
apply
(
bool
);
inline
double
getBenef
()
const
{
return
_benef
;}
inline
int
numTriangle
()
const
{
return
_isolated
.
size
();}
private
:
//std::set<TrianglesUnion*, lessTriUnion> _setQuads;
std
::
list
<
TrianglesUnion
*>
_setQuads
;
void
_removeImpossible
(
std
::
list
<
TrianglesUnion
*>::
iterator
);
std
::
list
<
TrianglesUnion
*>
_lastQuad
;
mapTriUnion
_possibleActions
;
mapTriUnion
_lessActions
;
void
_removeImpossible
(
TrianglesUnion
*
);
void
_recombine
(
bool
);
void
_lookAhead
(
std
::
list
<
TrianglesUnion
*>&
,
int
horiz
);
void
_getIncompatibles
(
const
TrianglesUnion
*
,
setTriUnion
&
);
void
_getNeighbors
(
const
TrianglesUnion
*
,
setTriUnion
&
);
void
_addNeighbors
(
int
horiz
,
std
::
vector
<
list_actions
::
iterator
>&
,
int
current
,
list_actions
*
);
void
_removeNeighbors
(
int
horiz
,
int
current
,
list_actions
*
);
int
_checkIsolatedTri
(
std
::
vector
<
list_actions
::
iterator
>&
,
int
size
,
std
::
set
<
MTriangle
*>&
);
public
:
int
apply
(
bool
);
};
class
RecombTriangle
{
...
...
@@ -135,9 +316,6 @@ class Rec2d_vertex {
// GEntity : virtual Range<double> parBounds(int i)
static
double
**
_Vvalues
;
static
double
**
_Vbenefs
;
void
_initStaticTable
();
double
_computeAngle
(
MVertex
*
,
std
::
list
<
MTriangle
*>
&
,
std
::
set
<
GEdge
*>
&
);
public
:
Rec2d_vertex
(
MVertex
*
,
std
::
list
<
MTriangle
*>
&
,
...
...
@@ -146,6 +324,12 @@ class Rec2d_vertex {
inline
void
changeNumEl
(
int
c
)
{
_numEl
+=
c
;}
double
getReward
();
double
getReward
(
int
);
//int onwhat() {return _onWhat;}
//int numel() {return _numEl;}
private
:
void
_initStaticTable
();
double
_computeAngle
(
MVertex
*
,
std
::
list
<
MTriangle
*>
&
,
std
::
set
<
GEdge
*>
&
);
};
class
TrianglesUnion
{
...
...
@@ -155,24 +339,31 @@ class TrianglesUnion {
Rec2d_vertex
**
_vertices
;
MTriangle
**
_triangles
;
static
int
_RECOMPUTE
;
//incremented when a recombination is executed
public:
static
int
_NumEdge
,
_NumVert
;
static
double
_ValEdge
,
_ValVert
;
private:
double
_computeEdgeLength
(
GFace
*
,
MVertex
**
,
double
*
u
,
double
*
v
,
int
numIntermedPoint
=
1
);
double
_computeAlignment
(
MEdge
&
,
std
::
list
<
MTriangle
*>
&
);
void
_update
();
public
:
TrianglesUnion
(
GFace
*
,
std
::
list
<
MTriangle
*>
&
,
std
::
list
<
MEdge
>
&
,
std
::
list
<
Rec2d_vertex
*>
&
,
std
::
map
<
MVertex
*
,
double
>
&
);
bool
operator
<
(
TrianglesUnion
&
other
);
inline
double
getEdgeValue
()
{
return
_embEdgeValue
;}
inline
double
getNumTriangles
()
{
return
_numTri
;}
inline
MTriangle
*
getTriangle
(
int
num
)
{
return
_triangles
[
num
];}
void
addTri
(
std
::
set
<
MTriangle
*>&
)
const
;
void
removeTri
(
std
::
set
<
MTriangle
*>&
)
const
;
bool
isIn
(
std
::
set
<
MTriangle
*>&
)
const
;
void
addInfluence
(
int
*
,
double
*
,
std
::
map
<
Rec2d_vertex
*
,
int
>&
)
const
;
void
removeInfluence
(
int
*
,
double
*
,
std
::
map
<
Rec2d_vertex
*
,
int
>&
)
const
;
static
double
computeReturn
(
const
int
*
,
const
double
*
,
const
std
::
map
<
Rec2d_vertex
*
,
int
>&
);
inline
double
getEdgeValue
()
const
{
return
_embEdgeValue
;}
inline
double
getVertValue
()
const
{
return
_embVertValue
;}
inline
int
getNumVerts
()
const
{
return
_numEmbVert
;}
inline
int
getNumEdges
()
const
{
return
_numEmbEdge
;}
inline
int
getNumVertices
()
const
{
return
_numBoundVert
;}
inline
Rec2d_vertex
*
getVertex
(
int
num
)
const
{
return
_vertices
[
num
];}
inline
int
getNumTriangles
()
const
{
return
_numTri
;}
inline
MTriangle
*
getTriangle
(
int
num
)
const
{
return
_triangles
[
num
];}
void
select
()
{
_ValEdge
-=
_embEdgeValue
;
_NumEdge
-=
_numEmbEdge
;
...
...
@@ -184,7 +375,7 @@ class TrianglesUnion {
}
_RECOMPUTE
++
;
}
MQuadrangle
*
createQuad
()
const
;
MQuadrangle
*
createQuad
()
const
;
void
print
()
{
Msg
::
Info
(
"Printing TU (%d,%d,%d,%d)"
,
_numEmbVert
,
_numBoundVert
,
_numEmbEdge
,
_numTri
);
for
(
int
i
=
0
;
i
<
_numTri
;
i
++
)
...
...
@@ -192,5 +383,11 @@ class TrianglesUnion {
}
static
inline
void
addRec
()
{
_RECOMPUTE
++
;}
inline
double
getReturn
()
{
return
_globValIfExecuted
;}
private
:
double
_computeEdgeLength
(
GFace
*
,
MVertex
**
,
double
*
u
,
double
*
v
,
int
numIntermedPoint
=
1
);
double
_computeAlignment
(
MEdge
&
,
std
::
list
<
MTriangle
*>
&
);
void
_update
();
};
#endif
This diff is collapsed.
Click to expand it.
Mesh/meshRecombine2D_2.cpp
+
508
−
91
View file @
86c13536
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