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
9bcd7263
Commit
9bcd7263
authored
17 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
smoothing for ElementData fields
parent
eb7d4023
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
Post/PViewDataGModel.cpp
+44
-1
44 additions, 1 deletion
Post/PViewDataGModel.cpp
Post/PViewDataGModel.h
+5
-1
5 additions, 1 deletion
Post/PViewDataGModel.h
Post/PViewDataGModelIO.cpp
+1
-3
1 addition, 3 deletions
Post/PViewDataGModelIO.cpp
with
50 additions
and
5 deletions
Post/PViewDataGModel.cpp
+
44
−
1
View file @
9bcd7263
// $Id: PViewDataGModel.cpp,v 1.
39
2008-03-30 1
0
:2
5
:0
9
geuzaine Exp $
// $Id: PViewDataGModel.cpp,v 1.
40
2008-03-30 1
3
:2
1
:0
4
geuzaine Exp $
//
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
...
...
@@ -24,6 +24,7 @@
#include
"PViewDataGModel.h"
#include
"MElement.h"
#include
"Numeric.h"
#include
"Message.h"
PViewDataGModel
::
PViewDataGModel
()
...
...
@@ -180,6 +181,48 @@ int PViewDataGModel::getNumEdges(int step, int ent, int ele)
return
_steps
[
step
]
->
getEntity
(
ent
)
->
getMeshElement
(
ele
)
->
getNumEdges
();
}
void
PViewDataGModel
::
smooth
()
{
if
(
_type
==
NodeData
)
return
;
std
::
vector
<
stepData
<
double
>*>
_steps2
;
for
(
unsigned
int
step
=
0
;
step
<
_steps
.
size
();
step
++
){
GModel
*
m
=
_steps
[
step
]
->
getModel
();
int
numComp
=
_steps
[
step
]
->
getNumComponents
();
_steps2
.
push_back
(
new
stepData
<
double
>
(
m
,
numComp
,
_steps
[
step
]
->
getFileName
(),
_steps
[
step
]
->
getFileIndex
()));
std
::
map
<
int
,
int
>
nodeConnect
;
for
(
int
ent
=
0
;
ent
<
getNumEntities
(
step
);
ent
++
){
for
(
int
ele
=
0
;
ele
<
getNumElements
(
step
,
ent
);
ele
++
){
MElement
*
e
=
_steps
[
step
]
->
getEntity
(
ent
)
->
getMeshElement
(
ele
);
for
(
int
nod
=
0
;
nod
<
e
->
getNumVertices
();
nod
++
){
MVertex
*
v
=
e
->
getVertex
(
nod
);
if
(
nodeConnect
.
count
(
v
->
getNum
()))
nodeConnect
[
v
->
getNum
()]
++
;
else
nodeConnect
[
v
->
getNum
()]
=
1
;
double
*
d
=
_steps2
.
back
()
->
getData
(
v
->
getNum
(),
true
),
val
;
for
(
int
j
=
0
;
j
<
numComp
;
j
++
)
if
(
getValue
(
step
,
e
->
getNum
(),
j
,
val
))
d
[
j
]
+=
val
;
}
}
}
for
(
int
i
=
0
;
i
<
_steps2
.
back
()
->
getNumData
();
i
++
){
double
*
d
=
_steps2
.
back
()
->
getData
(
i
);
if
(
d
){
double
f
=
nodeConnect
[
i
];
if
(
f
)
for
(
int
j
=
0
;
j
<
numComp
;
j
++
)
d
[
j
]
/=
f
;
double
s
=
ComputeScalarRep
(
numComp
,
d
);
_steps2
[
step
]
->
setMin
(
std
::
min
(
_steps2
[
step
]
->
getMin
(),
s
));
_steps2
[
step
]
->
setMax
(
std
::
max
(
_steps2
[
step
]
->
getMax
(),
s
));
}
}
}
for
(
unsigned
int
i
=
0
;
i
<
_steps
.
size
();
i
++
)
delete
_steps
[
i
];
_steps
=
_steps2
;
_type
=
NodeData
;
finalize
();
}
bool
PViewDataGModel
::
skipEntity
(
int
step
,
int
ent
)
{
return
!
_steps
[
step
]
->
getEntity
(
ent
)
->
getVisibility
();
...
...
This diff is collapsed.
Click to expand it.
Post/PViewDataGModel.h
+
5
−
1
View file @
9bcd7263
...
...
@@ -95,7 +95,10 @@ class stepData{
{
if
(
allocIfNeeded
){
if
(
index
>=
getNumData
())
resizeData
(
index
+
100
);
// optimize this
if
(
!
(
*
_data
)[
index
])
(
*
_data
)[
index
]
=
new
real
[
_numComp
*
mult
];
if
(
!
(
*
_data
)[
index
]){
(
*
_data
)[
index
]
=
new
real
[
_numComp
*
mult
];
for
(
int
i
=
0
;
i
<
_numComp
*
mult
;
i
++
)
(
*
_data
)[
index
][
i
]
=
0.
;
}
}
else
{
if
(
index
>=
getNumData
())
return
0
;
...
...
@@ -150,6 +153,7 @@ class PViewDataGModel : public PViewData {
int
getNumComponents
(
int
step
,
int
ent
,
int
ele
);
void
getValue
(
int
step
,
int
ent
,
int
ele
,
int
node
,
int
comp
,
double
&
val
);
int
getNumEdges
(
int
step
,
int
ent
,
int
ele
);
void
smooth
();
bool
skipEntity
(
int
step
,
int
ent
);
bool
skipElement
(
int
step
,
int
ent
,
int
ele
);
bool
hasTimeStep
(
int
step
);
...
...
This diff is collapsed.
Click to expand it.
Post/PViewDataGModelIO.cpp
+
1
−
3
View file @
9bcd7263
// $Id: PViewDataGModelIO.cpp,v 1.2
3
2008-03-30 1
1:53
:04 geuzaine Exp $
// $Id: PViewDataGModelIO.cpp,v 1.2
4
2008-03-30 1
3:21
:04 geuzaine Exp $
//
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
...
...
@@ -320,8 +320,6 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
double
*
d
=
_steps
[
step
]
->
getData
(
num
,
true
,
mult
);
for
(
int
j
=
0
;
j
<
numComp
*
mult
;
j
++
)
d
[
j
]
=
val
[
numComp
*
i
+
j
];
for
(
int
j
=
numComp
;
j
<
_steps
[
step
]
->
getNumComponents
();
j
++
)
d
[
j
]
=
0.
;
double
s
=
ComputeScalarRep
(
_steps
[
step
]
->
getNumComponents
(),
d
);
_steps
[
step
]
->
setMin
(
std
::
min
(
_steps
[
step
]
->
getMin
(),
s
));
_steps
[
step
]
->
setMax
(
std
::
max
(
_steps
[
step
]
->
getMax
(),
s
));
...
...
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