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
afc2ef81
Commit
afc2ef81
authored
10 years ago
by
Amaury Johnen
Browse files
Options
Downloads
Patches
Plain Diff
fix memory leak
parent
26ca193d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Numeric/JacobianBasis.cpp
+1
-0
1 addition, 0 deletions
Numeric/JacobianBasis.cpp
Plugin/AnalyseCurvedMesh.cpp
+28
-50
28 additions, 50 deletions
Plugin/AnalyseCurvedMesh.cpp
Plugin/AnalyseCurvedMesh.h
+21
-0
21 additions, 0 deletions
Plugin/AnalyseCurvedMesh.h
with
50 additions
and
50 deletions
Numeric/JacobianBasis.cpp
+
1
−
0
View file @
afc2ef81
...
@@ -770,6 +770,7 @@ fullMatrix<double> JacobianBasis::generateJacMonomialsPyramid(int order)
...
@@ -770,6 +770,7 @@ fullMatrix<double> JacobianBasis::generateJacMonomialsPyramid(int order)
monomials
(
index
,
2
)
=
k
;
monomials
(
index
,
2
)
=
k
;
}
}
}
}
return
monomials
;
return
monomials
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Plugin/AnalyseCurvedMesh.cpp
+
28
−
50
View file @
afc2ef81
...
@@ -12,11 +12,8 @@
...
@@ -12,11 +12,8 @@
#include
<queue>
#include
<queue>
#include
<sstream>
#include
<sstream>
//#include "Gmsh.h"
#include
"GmshMessage.h"
//#include "GmshMessage.h"
#include
"PView.h"
//#include "polynomialBasis.h"
//#include <fstream>
//#include "PView.h"
#if defined(HAVE_OPENGL)
#if defined(HAVE_OPENGL)
#include
"drawContext.h"
#include
"drawContext.h"
...
@@ -211,7 +208,7 @@ PView *GMSH_AnalyseCurvedMeshPlugin::execute(PView *v)
...
@@ -211,7 +208,7 @@ PView *GMSH_AnalyseCurvedMeshPlugin::execute(PView *v)
MElement
*
const
el
=
_data
[
i
].
element
();
MElement
*
const
el
=
_data
[
i
].
element
();
if
(
el
->
getDim
()
==
_dim
)
{
if
(
el
->
getDim
()
==
_dim
)
{
double
val
=
_computeMetric
?
_data
[
i
].
minR
()
:
_data
[
i
].
minJ
();
double
val
=
_computeMetric
?
_data
[
i
].
minR
()
:
_data
[
i
].
minJ
();
if
(
_data
[
i
].
maxJ
()
-
_data
[
i
].
minJ
()
<
_tol
*
1e-
2
)
if
(
_data
[
i
].
maxJ
()
-
_data
[
i
].
minJ
()
<
_tol
*
1e-
1
)
(
*
dataPV1
)[
el
->
getNum
()].
push_back
(
val
);
(
*
dataPV1
)[
el
->
getNum
()].
push_back
(
val
);
else
else
(
*
dataPV2
)[
el
->
getNum
()].
push_back
(
val
);
(
*
dataPV2
)[
el
->
getNum
()].
push_back
(
val
);
...
@@ -298,6 +295,8 @@ void GMSH_AnalyseCurvedMeshPlugin::_computeMinMaxJandValidity(MElement *const*el
...
@@ -298,6 +295,8 @@ void GMSH_AnalyseCurvedMeshPlugin::_computeMinMaxJandValidity(MElement *const*el
return
;
return
;
}
}
_data
.
reserve
(
_data
.
size
()
+
numEl
);
const
int
numSamplingPt
=
jfs
->
getNumJacNodes
();
const
int
numSamplingPt
=
jfs
->
getNumJacNodes
();
const
int
numMapNodes
=
jfs
->
getNumMapNodes
();
const
int
numMapNodes
=
jfs
->
getNumMapNodes
();
fullVector
<
double
>
jacobian
(
numSamplingPt
);
fullVector
<
double
>
jacobian
(
numSamplingPt
);
...
@@ -324,17 +323,23 @@ void GMSH_AnalyseCurvedMeshPlugin::_computeMinMaxJandValidity(MElement *const*el
...
@@ -324,17 +323,23 @@ void GMSH_AnalyseCurvedMeshPlugin::_computeMinMaxJandValidity(MElement *const*el
bj
->
subDivisions
(
subJacBez
);
bj
->
subDivisions
(
subJacBez
);
currentDepth
=
bj
->
depth
()
+
1
;
currentDepth
=
bj
->
depth
()
+
1
;
if
(
currentDepth
>
20
)
Msg
::
Error
(
"depth is too damn high !"
);
if
(
currentDepth
>
20
)
{
static
int
a
=
0
;
if
(
++
a
==
1
)
Msg
::
Error
(
"depth is too damn high ! elem type %d"
,
el
[
k
]
->
getTypeForMSH
());
}
for
(
int
i
=
0
;
i
<
jfs
->
getNumDivisions
();
i
++
)
{
for
(
int
i
=
0
;
i
<
jfs
->
getNumDivisions
();
i
++
)
{
jacBez
.
setAsProxy
(
subJacBez
,
i
*
numSamplingPt
,
numSamplingPt
);
jacBez
.
setAsProxy
(
subJacBez
,
i
*
numSamplingPt
,
numSamplingPt
);
bj
=
new
BezierJacobian
(
jacBez
,
jfs
,
currentDepth
);
BezierJacobian
*
new
bj
=
new
BezierJacobian
(
jacBez
,
jfs
,
currentDepth
);
minL
=
std
::
min
(
minL
,
bj
->
minL
());
minL
=
std
::
min
(
minL
,
new
bj
->
minL
());
maxL
=
std
::
max
(
maxL
,
bj
->
maxL
());
maxL
=
std
::
max
(
maxL
,
new
bj
->
maxL
());
heap
.
push_back
(
bj
);
heap
.
push_back
(
new
bj
);
push_heap
(
heap
.
begin
(),
heap
.
end
(),
lessMinVal
());
push_heap
(
heap
.
begin
(),
heap
.
end
(),
lessMinVal
());
}
}
delete
bj
;
}
}
make_heap
(
heap
.
begin
(),
heap
.
end
(),
lessMax
());
make_heap
(
heap
.
begin
(),
heap
.
end
(),
lessMax
());
...
@@ -346,17 +351,23 @@ void GMSH_AnalyseCurvedMeshPlugin::_computeMinMaxJandValidity(MElement *const*el
...
@@ -346,17 +351,23 @@ void GMSH_AnalyseCurvedMeshPlugin::_computeMinMaxJandValidity(MElement *const*el
bj
->
subDivisions
(
subJacBez
);
bj
->
subDivisions
(
subJacBez
);
currentDepth
=
bj
->
depth
()
+
1
;
currentDepth
=
bj
->
depth
()
+
1
;
if
(
currentDepth
>
20
)
Msg
::
Error
(
"depth is too damn high !"
);
if
(
currentDepth
>
20
)
{
static
int
a
=
0
;
if
(
++
a
==
1
)
Msg
::
Error
(
"depth is too damn high ! elem type %d"
,
el
[
k
]
->
getTypeForMSH
());
}
for
(
int
i
=
0
;
i
<
jfs
->
getNumDivisions
();
i
++
)
{
for
(
int
i
=
0
;
i
<
jfs
->
getNumDivisions
();
i
++
)
{
jacBez
.
setAsProxy
(
subJacBez
,
i
*
numSamplingPt
,
numSamplingPt
);
jacBez
.
setAsProxy
(
subJacBez
,
i
*
numSamplingPt
,
numSamplingPt
);
bj
=
new
BezierJacobian
(
jacBez
,
jfs
,
currentDepth
);
BezierJacobian
*
new
bj
=
new
BezierJacobian
(
jacBez
,
jfs
,
currentDepth
);
minL
=
std
::
min
(
minL
,
bj
->
minL
());
minL
=
std
::
min
(
minL
,
new
bj
->
minL
());
maxL
=
std
::
max
(
maxL
,
bj
->
maxL
());
maxL
=
std
::
max
(
maxL
,
new
bj
->
maxL
());
heap
.
push_back
(
bj
);
heap
.
push_back
(
new
bj
);
push_heap
(
heap
.
begin
(),
heap
.
end
(),
lessMax
());
push_heap
(
heap
.
begin
(),
heap
.
end
(),
lessMax
());
}
}
delete
bj
;
}
}
double
minB
=
minL
;
double
minB
=
minL
;
...
@@ -364,41 +375,8 @@ void GMSH_AnalyseCurvedMeshPlugin::_computeMinMaxJandValidity(MElement *const*el
...
@@ -364,41 +375,8 @@ void GMSH_AnalyseCurvedMeshPlugin::_computeMinMaxJandValidity(MElement *const*el
for
(
unsigned
int
i
=
0
;
i
<
heap
.
size
();
++
i
)
{
for
(
unsigned
int
i
=
0
;
i
<
heap
.
size
();
++
i
)
{
minB
=
std
::
min
(
minB
,
heap
[
i
]
->
minB
());
minB
=
std
::
min
(
minB
,
heap
[
i
]
->
minB
());
maxB
=
std
::
max
(
maxB
,
heap
[
i
]
->
maxB
());
maxB
=
std
::
max
(
maxB
,
heap
[
i
]
->
maxB
());
delete
heap
[
i
];
}
}
// TODO REMOVE #include "BasisFactory.h"
/*if (el[k]->getNum() == 26776) {
Msg::Info("%g %g %g %g", minB, minL, maxL, maxB);
/ *const nodalBasis* nb = BasisFactory::getNodalBasis(el[k]->getTypeForMSH());
int tag1 = ElementType::getTag(el[k]->getType(), 1);
const nodalBasis* nb1 = BasisFactory::getNodalBasis(tag1);
//double *f;
//f = new double[nb1->points.size1()];
fullMatrix<double> f;
nb1->f(nb->points, f);
Msg::Info("SIZES [%d %d] (%d, %d)", f.size1(), f.size2(), nb->points.size1(), nb1->points.size1());
for (int i = 0; i < nb->points.size1(); ++i) {
double X[3] = {0, 0, 0};
for (int j = 0; j < f.size2(); ++j) {
X[0] += el[k]->getVertex(j)->x() * f(i, j);
X[1] += el[k]->getVertex(j)->y() * f(i, j);
X[2] += el[k]->getVertex(j)->z() * f(i, j);
}
if (std::abs(X[0] - el[k]->getVertex(i)->x()) < 1e-12 &&
std::abs(X[1] - el[k]->getVertex(i)->y()) < 1e-12 &&
std::abs(X[2] - el[k]->getVertex(i)->z()) < 1e-12);
else {
Msg::Info("aaarg %d/%d : [%g %g %g] ([%g %g %g])", i+1, nb->points.size1(),
el[k]->getVertex(i)->x(), el[k]->getVertex(i)->y(), el[k]->getVertex(i)->z(),
X[0], X[1], X[2]);
}
}* /
}*/
_data
.
push_back
(
CurvedMeshPluginData
(
el
[
k
],
minB
,
maxB
));
_data
.
push_back
(
CurvedMeshPluginData
(
el
[
k
],
minB
,
maxB
));
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Plugin/AnalyseCurvedMesh.h
+
21
−
0
View file @
afc2ef81
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include
"JacobianBasis.h"
#include
"JacobianBasis.h"
#include
"MetricBasis.h"
#include
"MetricBasis.h"
#include
"MElement.h"
#include
"MElement.h"
#include
"OS.h"
#include
<vector>
#include
<vector>
...
@@ -46,6 +47,7 @@ private :
...
@@ -46,6 +47,7 @@ private :
double
_threshold
,
_tol
;
double
_threshold
,
_tol
;
int
_numPView
,
_computeMetric
;
int
_numPView
,
_computeMetric
;
bool
_recompute
;
bool
_recompute
;
bool
_computedR3D
,
_computedR2D
;
bool
_computedR3D
,
_computedR2D
;
bool
_computedJ3D
,
_computedJ2D
,
_computedJ1D
;
bool
_computedJ3D
,
_computedJ2D
,
_computedJ1D
;
bool
_1PViewJ
,
_2PViewJ
,
_1PViewR
,
_2PViewR
;
bool
_1PViewJ
,
_2PViewJ
,
_1PViewR
,
_2PViewR
;
...
@@ -75,6 +77,25 @@ public :
...
@@ -75,6 +77,25 @@ public :
int
getNbOptions
()
const
;
int
getNbOptions
()
const
;
StringXNumber
*
getOption
(
int
);
StringXNumber
*
getOption
(
int
);
PView
*
execute
(
PView
*
);
PView
*
execute
(
PView
*
);
void
setTol
(
double
tol
)
{
_tol
=
tol
;}
void
computeMinJ
(
MElement
*
const
*
el
,
int
numEl
,
double
*
minJ
,
bool
*
straight
)
{
std
::
vector
<
CurvedMeshPluginData
>
save
(
_data
);
_data
.
clear
();
double
time
=
Cpu
();
//Rmv add OS.H
_computeMinMaxJandValidity
(
el
,
numEl
);
if
(
minJ
)
{
for
(
unsigned
int
i
=
0
;
i
<
_data
.
size
();
++
i
)
{
minJ
[
i
]
=
_data
[
i
].
minJ
();
}
}
if
(
straight
)
{
for
(
unsigned
int
i
=
0
;
i
<
_data
.
size
();
++
i
)
{
straight
[
i
]
=
_data
[
i
].
maxJ
()
-
_data
[
i
].
minJ
()
<
_tol
*
1e-1
;
}
}
_data
=
save
;
}
private
:
private
:
void
_computeMinMaxJandValidity
();
void
_computeMinMaxJandValidity
();
...
...
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