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
2388ca56
Commit
2388ca56
authored
13 years ago
by
Emilie Sauvage
Browse files
Options
Downloads
Patches
Plain Diff
No commit message
No commit message
parent
0610a14b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Geo/Curvature.cpp
+80
-0
80 additions, 0 deletions
Geo/Curvature.cpp
Geo/Curvature.h
+3
-1
3 additions, 1 deletion
Geo/Curvature.h
with
83 additions
and
1 deletion
Geo/Curvature.cpp
+
80
−
0
View file @
2388ca56
...
...
@@ -885,6 +885,7 @@ void Curvature::computeCurvature(GModel* model, typeOfCurvature typ)
double
t1
=
Cpu
();
Msg
::
StatusBar
(
2
,
true
,
"(C) Done Computing Curvature (%g s)"
,
t1
-
t0
);
writeToMshFile
(
"curvature.msh"
);
writeToPosFile
(
"curvature.pos"
);
writeToVtkFile
(
"curvature.vtk"
);
...
...
@@ -1433,6 +1434,85 @@ double Curvature::getAtVertex(const MVertex *v) const {
return
_VertexCurve
[
it
->
second
];
}
//========================================================================================================
void
Curvature
::
writeToMshFile
(
const
std
::
string
&
filename
)
{
std
::
ofstream
outfile
;
outfile
.
precision
(
18
);
outfile
.
open
(
filename
.
c_str
());
/// Write the values of curvature
outfile
<<
"$MeshFormat"
<<
std
::
endl
;
outfile
<<
"2.1 0 8"
<<
std
::
endl
;
outfile
<<
"$EndMeshFormat"
<<
std
::
endl
;
outfile
<<
"$NodeData"
<<
std
::
endl
;
outfile
<<
"1"
<<
std
::
endl
;
// One string tag
outfile
<<
"
\"
Curvature
\"
"
<<
std
::
endl
;
// The name of the view
outfile
<<
"1"
<<
std
::
endl
;
// One real tag
outfile
<<
"0.0"
<<
std
::
endl
;
// The time value
outfile
<<
"3"
<<
std
::
endl
;
// Three integer tags
outfile
<<
"0"
<<
std
::
endl
;
// The time step (time steps always start at 0)
outfile
<<
"1"
<<
std
::
endl
;
// 1-component (scalar) field
outfile
<<
_VertexToInt
.
size
()
<<
std
::
endl
;
// How many associated nodal values
std
::
map
<
int
,
int
>::
const_iterator
vertex_iterator
;
for
(
vertex_iterator
=
_VertexToInt
.
begin
();
vertex_iterator
!=
_VertexToInt
.
end
();
++
vertex_iterator
)
{
outfile
<<
vertex_iterator
->
first
<<
" "
<<
_VertexCurve
[
vertex_iterator
->
second
]
<<
std
::
endl
;
}
outfile
<<
"$EndNodeData"
<<
std
::
endl
;
/// Write the values of curvature direction - principal direction 1
outfile
<<
"$NodeData"
<<
std
::
endl
;
outfile
<<
"1"
<<
std
::
endl
;
// One string tag
outfile
<<
"
\"
Principal curvature direction 1
\"
"
<<
std
::
endl
;
// The name of the view
outfile
<<
"1"
<<
std
::
endl
;
// One real tag
outfile
<<
"0.0"
<<
std
::
endl
;
// The time value
outfile
<<
"3"
<<
std
::
endl
;
// Three integer tags
outfile
<<
"0"
<<
std
::
endl
;
// The time step (time steps always start at 0)
outfile
<<
"3"
<<
std
::
endl
;
// 3-component (vector) field
outfile
<<
_VertexToInt
.
size
()
<<
std
::
endl
;
// How many associated nodal values
for
(
vertex_iterator
=
_VertexToInt
.
begin
();
vertex_iterator
!=
_VertexToInt
.
end
();
++
vertex_iterator
)
{
outfile
<<
vertex_iterator
->
first
<<
" "
<<
_pdir1
[
vertex_iterator
->
second
].
x
()
<<
" "
<<
_pdir1
[
vertex_iterator
->
second
].
y
()
<<
" "
<<
_pdir1
[
vertex_iterator
->
second
].
z
()
<<
std
::
endl
;
}
outfile
<<
"$EndNodeData"
<<
std
::
endl
;
/// Write the values of curvature direction - principal direction 1
outfile
<<
"$NodeData"
<<
std
::
endl
;
outfile
<<
"1"
<<
std
::
endl
;
// One string tag
outfile
<<
"
\"
Principal curvature direction 2
\"
"
<<
std
::
endl
;
// The name of the view
outfile
<<
"1"
<<
std
::
endl
;
// One real tag
outfile
<<
"0.0"
<<
std
::
endl
;
// The time value
outfile
<<
"3"
<<
std
::
endl
;
// Three integer tags
outfile
<<
"0"
<<
std
::
endl
;
// The time step (time steps always start at 0)
outfile
<<
"3"
<<
std
::
endl
;
// 3-component (vector) field
outfile
<<
_VertexToInt
.
size
()
<<
std
::
endl
;
// How many associated nodal values
for
(
vertex_iterator
=
_VertexToInt
.
begin
();
vertex_iterator
!=
_VertexToInt
.
end
();
++
vertex_iterator
)
{
outfile
<<
vertex_iterator
->
first
<<
" "
<<
_pdir2
[
vertex_iterator
->
second
].
x
()
<<
" "
<<
_pdir2
[
vertex_iterator
->
second
].
y
()
<<
" "
<<
_pdir2
[
vertex_iterator
->
second
].
z
()
<<
std
::
endl
;
}
outfile
<<
"$EndNodeData"
<<
std
::
endl
;
outfile
.
close
();
}
//========================================================================================================
void
Curvature
::
writeToPosFile
(
const
std
::
string
&
filename
)
{
std
::
ofstream
outfile
;
...
...
This diff is collapsed.
Click to expand it.
Geo/Curvature.h
+
3
−
1
View file @
2388ca56
...
...
@@ -64,7 +64,7 @@ private:
//Averaged vertex normals
std
::
vector
<
SVector3
>
_VertexNormal
;
// Vector of principal dir
c
ections
// Vector of principal directions
std
::
vector
<
SVector3
>
_pdir1
;
std
::
vector
<
SVector3
>
_pdir2
;
...
...
@@ -213,6 +213,8 @@ public:
void
edgeNodalValues
(
MLine
*
edge
,
double
&
c0
,
double
&
c1
,
int
isAbs
=
0
);
void
writeToMshFile
(
const
std
::
string
&
filename
);
void
writeToPosFile
(
const
std
::
string
&
filename
);
void
writeToVtkFile
(
const
std
::
string
&
filename
);
...
...
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