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
375cba58
Commit
375cba58
authored
17 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
basic IO for new node based data; should be enough for tests
parent
5e3944ee
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
Post/PViewDataGModel.cpp
+8
-8
8 additions, 8 deletions
Post/PViewDataGModel.cpp
Post/PViewDataGModel.h
+4
-5
4 additions, 5 deletions
Post/PViewDataGModel.h
Post/PViewDataGModelIO.cpp
+5
-5
5 additions, 5 deletions
Post/PViewDataGModelIO.cpp
Post/PViewDataListIO.cpp
+1
-3
1 addition, 3 deletions
Post/PViewDataListIO.cpp
with
18 additions
and
21 deletions
Post/PViewDataGModel.cpp
+
8
−
8
View file @
375cba58
// $Id: PViewDataGModel.cpp,v 1.2
4
2008-03-10 1
6:01:16
geuzaine Exp $
// $Id: PViewDataGModel.cpp,v 1.2
5
2008-03-10 1
9:59:01
geuzaine Exp $
//
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
...
...
@@ -66,7 +66,7 @@ int PViewDataGModel::getNumTimeSteps()
double
PViewDataGModel
::
getTime
(
int
step
)
{
if
(
step
<
_nodeData
.
size
()
&&
_nodeData
[
step
])
if
(
step
<
(
int
)
_nodeData
.
size
()
&&
_nodeData
[
step
])
return
_nodeData
[
step
]
->
time
;
return
0.
;
}
...
...
@@ -74,14 +74,14 @@ double PViewDataGModel::getTime(int step)
double
PViewDataGModel
::
getMin
(
int
step
)
{
if
(
step
<
0
)
return
_min
;
if
(
step
<
_nodeData
.
size
()
&&
_nodeData
[
step
])
return
_nodeData
[
step
]
->
min
;
if
(
step
<
(
int
)
_nodeData
.
size
()
&&
_nodeData
[
step
])
return
_nodeData
[
step
]
->
min
;
return
0.
;
}
double
PViewDataGModel
::
getMax
(
int
step
)
{
if
(
step
<
0
)
return
_max
;
if
(
step
<
_nodeData
.
size
()
&&
_nodeData
[
step
])
return
_nodeData
[
step
]
->
max
;
if
(
step
<
(
int
)
_nodeData
.
size
()
&&
_nodeData
[
step
])
return
_nodeData
[
step
]
->
max
;
return
0.
;
}
...
...
@@ -142,12 +142,12 @@ bool PViewDataGModel::skipEntity(int ent)
bool
PViewDataGModel
::
skipElement
(
int
ent
,
int
ele
,
int
step
)
{
if
(
step
>=
_nodeData
.
size
()
||
!
_nodeData
[
step
])
return
true
;
if
(
step
>=
(
int
)
_nodeData
.
size
()
||
!
_nodeData
[
step
])
return
true
;
MElement
*
e
=
_entities
[
ent
]
->
getMeshElement
(
ele
);
if
(
!
e
->
getVisibility
())
return
true
;
for
(
int
i
=
0
;
i
<
e
->
getNumVertices
();
i
++
){
int
index
=
e
->
getVertex
(
i
)
->
getDataIndex
();
if
(
index
<
0
||
index
>=
_nodeData
[
step
]
->
values
.
size
())
return
true
;
if
(
index
<
0
||
index
>=
(
int
)
_nodeData
[
step
]
->
values
.
size
())
return
true
;
if
(
_nodeData
[
step
]
->
values
[
index
].
empty
())
return
true
;
}
return
false
;
...
...
@@ -155,8 +155,8 @@ bool PViewDataGModel::skipElement(int ent, int ele, int step)
bool
PViewDataGModel
::
hasTimeStep
(
int
step
)
{
if
(
step
<
_nodeData
.
size
()
&&
_nodeData
[
step
])
return
true
;
if
(
step
<
_elementData
.
size
()
&&
_elementData
[
step
])
return
true
;
if
(
step
<
(
int
)
_nodeData
.
size
()
&&
_nodeData
[
step
])
return
true
;
if
(
step
<
(
int
)
_elementData
.
size
()
&&
_elementData
[
step
])
return
true
;
return
false
;
}
...
...
This diff is collapsed.
Click to expand it.
Post/PViewDataGModel.h
+
4
−
5
View file @
375cba58
...
...
@@ -28,12 +28,10 @@
template
<
class
real
>
class
stepData
{
public:
std
::
string
fileName
;
// we allow to read steps from different files
int
fileIndex
;
double
time
,
min
,
max
;
// vector of data, indexed by dataIndex
std
::
vector
<
std
::
vector
<
real
>
>
values
;
stepData
()
:
fileIndex
(
0
),
time
(
0.
),
min
(
VAL_INF
),
max
(
-
VAL_INF
){}
stepData
()
:
time
(
0.
),
min
(
VAL_INF
),
max
(
-
VAL_INF
){}
~
stepData
()
{}
};
...
...
@@ -52,8 +50,6 @@ class PViewDataGModel : public PViewData {
SBoundingBox3d
_bbox
;
// a set of all "partitions" encountered in the input data
std
::
set
<
int
>
_partitions
;
// create old-style list-based dataset from this one
PViewDataList
*
_cloneToList
();
public:
PViewDataGModel
(
GModel
*
model
);
~
PViewDataGModel
();
...
...
@@ -76,6 +72,9 @@ class PViewDataGModel : public PViewData {
bool
hasTimeStep
(
int
step
);
bool
hasPartition
(
int
part
);
// create old-style list-based dataset from this one
//PViewDataList *convertToPViewDataList();
// I/O routines
bool
readMSH
(
FILE
*
fp
,
bool
binary
,
bool
swap
,
int
timeStep
,
double
time
,
int
partition
,
int
numComp
,
int
numNodes
);
...
...
This diff is collapsed.
Click to expand it.
Post/PViewDataGModelIO.cpp
+
5
−
5
View file @
375cba58
// $Id: PViewDataGModelIO.cpp,v 1.
5
2008-03-10 1
6:01:16
geuzaine Exp $
// $Id: PViewDataGModelIO.cpp,v 1.
6
2008-03-10 1
9:59:01
geuzaine Exp $
//
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
...
...
@@ -35,7 +35,7 @@ bool PViewDataGModel::readMSH(FILE *fp, bool binary, bool swap, int timeStep,
Msg
(
INFO
,
"Reading step %d (time %g) partition %d: %d nodes"
,
timeStep
,
time
,
partition
,
numNodes
);
while
(
timeStep
>=
_nodeData
.
size
())
_nodeData
.
push_back
(
0
);
while
(
timeStep
>=
(
int
)
_nodeData
.
size
())
_nodeData
.
push_back
(
0
);
if
(
!
_nodeData
[
timeStep
])
_nodeData
[
timeStep
]
=
new
stepData
<
double
>
();
...
...
@@ -64,10 +64,10 @@ bool PViewDataGModel::readMSH(FILE *fp, bool binary, bool swap, int timeStep,
v
->
setDataIndex
(
max
+
1
);
}
int
index
=
v
->
getDataIndex
();
if
(
index
>=
_nodeData
[
timeStep
]
->
values
.
size
())
if
(
index
>=
(
int
)
_nodeData
[
timeStep
]
->
values
.
size
())
_nodeData
[
timeStep
]
->
values
.
resize
(
index
+
100
);
// optimize this
if
(
binary
){
if
(
fread
(
&
tmp
[
0
],
sizeof
(
double
),
numComp
,
fp
)
!=
numComp
)
return
false
;
if
(
(
int
)
fread
(
&
tmp
[
0
],
sizeof
(
double
),
numComp
,
fp
)
!=
numComp
)
return
false
;
if
(
swap
)
swapBytes
((
char
*
)
&
tmp
[
0
],
sizeof
(
double
),
numComp
);
}
else
{
...
...
@@ -124,7 +124,7 @@ bool PViewDataGModel::writeMSH(std::string name, bool binary)
fprintf
(
fp
,
"
\"
%s
\"\n
"
,
getName
().
c_str
());
fprintf
(
fp
,
"%d %.16g 0 0 %d %d
\n
"
,
ts
,
_nodeData
[
ts
]
->
time
,
numComp
,
numNodes
);
for
(
unsigned
int
i
=
0
;
i
<
_nodeData
[
ts
]
->
values
.
size
();
i
++
){
if
(
_nodeData
[
ts
]
->
values
[
i
].
size
()
>=
numComp
){
if
(
(
int
)
_nodeData
[
ts
]
->
values
[
i
].
size
()
>=
numComp
){
if
(
binary
){
fwrite
(
&
tags
[
i
],
sizeof
(
int
),
1
,
fp
);
fwrite
(
&
_nodeData
[
ts
]
->
values
[
i
][
0
],
sizeof
(
double
),
numComp
,
fp
);
...
...
This diff is collapsed.
Click to expand it.
Post/PViewDataListIO.cpp
+
1
−
3
View file @
375cba58
// $Id: PViewDataListIO.cpp,v 1.1
5
2008-03-10 1
6:01:17
geuzaine Exp $
// $Id: PViewDataListIO.cpp,v 1.1
6
2008-03-10 1
9:59:01
geuzaine Exp $
//
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
...
...
@@ -584,7 +584,6 @@ bool PViewDataList::writeMSH(std::string name, bool binary)
writeElementsMSH
(
fp
,
NbTY
,
TY
,
5
,
9
,
3
,
&
nodes
,
&
numelm
);
fprintf
(
fp
,
"$EndElements
\n
"
);
#if 1 // test new node-based storage
int
numNodes
=
nodes
.
size
();
if
(
numNodes
){
int
numComp
=
nodes
.
begin
()
->
Val
.
size
()
/
NbTimeStep
;
...
...
@@ -603,7 +602,6 @@ bool PViewDataList::writeMSH(std::string name, bool binary)
fprintf
(
fp
,
"$EndNodeData
\n
"
);
}
}
#endif
fclose
(
fp
);
return
true
;
...
...
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