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
Package registry
Model registry
Operate
Terraform modules
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
Romin Tomasetti
gmsh
Commits
34220101
Commit
34220101
authored
7 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
new addData() using a vector of vectors (instead of a map)
parent
bc05e923
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Post/PView.cpp
+1
-1
1 addition, 1 deletion
Post/PView.cpp
Post/PView.h
+1
-1
1 addition, 1 deletion
Post/PView.h
Post/PViewDataGModel.h
+11
-3
11 additions, 3 deletions
Post/PViewDataGModel.h
Post/PViewDataGModelIO.cpp
+40
-3
40 additions, 3 deletions
Post/PViewDataGModelIO.cpp
with
53 additions
and
8 deletions
Post/PView.cpp
+
1
−
1
View file @
34220101
...
...
@@ -152,7 +152,7 @@ PView::PView(const std::string &name, const std::string &type,
_options
->
targetError
);
}
void
PView
::
addStep
(
GModel
*
model
,
std
::
map
<
int
,
std
::
vector
<
double
>
>
&
data
,
void
PView
::
addStep
(
GModel
*
model
,
const
std
::
map
<
int
,
std
::
vector
<
double
>
>
&
data
,
double
time
,
int
numComp
)
{
PViewDataGModel
*
d
=
dynamic_cast
<
PViewDataGModel
*>
(
_data
);
...
...
This diff is collapsed.
Click to expand it.
Post/PView.h
+
1
−
1
View file @
34220101
...
...
@@ -58,7 +58,7 @@ class PView{
std
::
map
<
int
,
std
::
vector
<
double
>
>
&
data
,
double
time
=
0.
,
int
numComp
=
-
1
);
// add a new time step to a given mesh-based view
void
addStep
(
GModel
*
model
,
std
::
map
<
int
,
std
::
vector
<
double
>
>
&
data
,
void
addStep
(
GModel
*
model
,
const
std
::
map
<
int
,
std
::
vector
<
double
>
>
&
data
,
double
time
=
0.
,
int
numComp
=
-
1
);
// default destructor
...
...
This diff is collapsed.
Click to expand it.
Post/PViewDataGModel.h
+
11
−
3
View file @
34220101
...
...
@@ -34,6 +34,9 @@ class stepData{
// optimal. This is the price to pay if we want 1) rapid access to
// the data and 2) not to store any additional info in MVertex or
// MElement)
//
// FIXME: we should change this design and store a vector<int> of tags, and do
// indirect addressing, even if it's a bit slower...
std
::
vector
<
Real
*>
*
_data
;
// a vector containing the multiplying factor allowing to compute
// the number of values stored in _data for each index (number of
...
...
@@ -242,7 +245,12 @@ class PViewDataGModel : public PViewData {
// Add some data "on the fly" (data is stored in a map, indexed by
// node or element number depending on the type of dataset)
bool
addData
(
GModel
*
model
,
std
::
map
<
int
,
std
::
vector
<
double
>
>
&
data
,
bool
addData
(
GModel
*
model
,
const
std
::
map
<
int
,
std
::
vector
<
double
>
>
&
data
,
int
step
,
double
time
,
int
partition
,
int
numComp
);
// Add some data "on the fly", without a map
bool
addData
(
GModel
*
model
,
const
std
::
vector
<
int
>
&
tags
,
const
std
::
vector
<
std
::
vector
<
double
>
>
&
data
,
int
step
,
double
time
,
int
partition
,
int
numComp
);
// Allow to destroy the data
...
...
@@ -252,8 +260,8 @@ class PViewDataGModel : public PViewData {
int
fileIndex
,
FILE
*
fp
,
bool
binary
,
bool
swap
,
int
step
,
double
time
,
int
partition
,
int
numComp
,
int
numNodes
,
const
std
::
string
&
interpolationScheme
);
virtual
bool
writeMSH
(
const
std
::
string
&
fileName
,
double
version
=
2.2
,
bool
binary
=
false
,
bool
savemesh
=
true
,
bool
multipleView
=
false
,
virtual
bool
writeMSH
(
const
std
::
string
&
fileName
,
double
version
=
2.2
,
bool
binary
=
false
,
bool
savemesh
=
true
,
bool
multipleView
=
false
,
int
partitionNum
=
0
,
bool
saveInterpolationMatrices
=
true
,
bool
forceNodeData
=
false
,
bool
forceElementData
=
false
);
bool
readMED
(
const
std
::
string
&
fileName
,
int
fileIndex
);
...
...
This diff is collapsed.
Click to expand it.
Post/PViewDataGModelIO.cpp
+
40
−
3
View file @
34220101
...
...
@@ -12,14 +12,15 @@
#include
"StringUtils.h"
#include
"OS.h"
bool
PViewDataGModel
::
addData
(
GModel
*
model
,
std
::
map
<
int
,
std
::
vector
<
double
>
>
&
data
,
bool
PViewDataGModel
::
addData
(
GModel
*
model
,
const
std
::
map
<
int
,
std
::
vector
<
double
>
>
&
data
,
int
step
,
double
time
,
int
partition
,
int
numComp
)
{
if
(
data
.
empty
())
return
false
;
if
(
numComp
<
0
){
numComp
=
9
;
for
(
std
::
map
<
int
,
std
::
vector
<
double
>
>::
iterator
it
=
data
.
begin
();
for
(
std
::
map
<
int
,
std
::
vector
<
double
>
>::
const_
iterator
it
=
data
.
begin
();
it
!=
data
.
end
();
it
++
)
numComp
=
std
::
min
(
numComp
,
(
int
)
it
->
second
.
size
());
}
...
...
@@ -34,7 +35,7 @@ bool PViewDataGModel::addData(GModel *model, std::map<int, std::vector<double> >
model
->
getNumMeshElements
();
_steps
[
step
]
->
resizeData
(
numEnt
);
for
(
std
::
map
<
int
,
std
::
vector
<
double
>
>::
iterator
it
=
data
.
begin
();
for
(
std
::
map
<
int
,
std
::
vector
<
double
>
>::
const_
iterator
it
=
data
.
begin
();
it
!=
data
.
end
();
it
++
){
int
mult
=
it
->
second
.
size
()
/
numComp
;
double
*
d
=
_steps
[
step
]
->
getData
(
it
->
first
,
true
,
mult
);
...
...
@@ -47,6 +48,42 @@ bool PViewDataGModel::addData(GModel *model, std::map<int, std::vector<double> >
return
true
;
}
bool
PViewDataGModel
::
addData
(
GModel
*
model
,
const
std
::
vector
<
int
>
&
tags
,
const
std
::
vector
<
std
::
vector
<
double
>
>
&
data
,
int
step
,
double
time
,
int
partition
,
int
numComp
)
{
printf
(
"data size %d tag size %d
\n
"
,
data
.
size
()
,
tags
.
size
());
if
(
data
.
empty
()
||
tags
.
empty
()
||
data
.
size
()
!=
tags
.
size
())
return
false
;
if
(
numComp
<
0
){
numComp
=
9
;
for
(
unsigned
int
i
=
0
;
i
<
data
.
size
();
i
++
)
numComp
=
std
::
min
(
numComp
,
(
int
)
data
[
i
].
size
());
}
while
(
step
>=
(
int
)
_steps
.
size
())
_steps
.
push_back
(
new
stepData
<
double
>
(
model
,
numComp
));
_steps
[
step
]
->
fillEntities
();
_steps
[
step
]
->
computeBoundingBox
();
_steps
[
step
]
->
setTime
(
time
);
int
numEnt
=
(
_type
==
NodeData
)
?
model
->
getNumMeshVertices
()
:
model
->
getNumMeshElements
();
_steps
[
step
]
->
resizeData
(
numEnt
);
for
(
unsigned
int
i
=
0
;
i
<
data
.
size
();
i
++
){
int
mult
=
data
[
i
].
size
()
/
numComp
;
double
*
d
=
_steps
[
step
]
->
getData
(
tags
[
i
],
true
,
mult
);
for
(
int
j
=
0
;
j
<
numComp
*
mult
;
j
++
)
d
[
j
]
=
data
[
i
][
j
];
}
if
(
partition
>=
0
)
_steps
[
step
]
->
getPartitions
().
insert
(
partition
);
finalize
();
return
true
;
}
void
PViewDataGModel
::
destroyData
()
{
for
(
unsigned
int
i
=
0
;
i
<
_steps
.
size
();
i
++
)
...
...
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