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
07b3cae7
Commit
07b3cae7
authored
12 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
export element groups for physicals
parent
f5f6e709
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Geo/GModelIO_UNV.cpp
+58
-26
58 additions, 26 deletions
Geo/GModelIO_UNV.cpp
doc/VERSIONS.txt
+3
-0
3 additions, 0 deletions
doc/VERSIONS.txt
with
61 additions
and
26 deletions
Geo/GModelIO_UNV.cpp
+
58
−
26
View file @
07b3cae7
...
@@ -175,6 +175,20 @@ int GModel::readUNV(const std::string &name)
...
@@ -175,6 +175,20 @@ int GModel::readUNV(const std::string &name)
return
1
;
return
1
;
}
}
static
std
::
string
physicalName
(
GModel
*
m
,
int
dim
,
int
num
)
{
std
::
string
name
=
m
->
getPhysicalName
(
dim
,
num
);
if
(
name
.
empty
()){
char
tmp
[
256
];
sprintf
(
tmp
,
"%s%d"
,
(
dim
==
3
)
?
"PhysicalVolume"
:
(
dim
==
2
)
?
"PhysicalSurface"
:
"PhysicalLine"
,
num
);
name
=
tmp
;
}
for
(
unsigned
int
i
=
0
;
i
<
name
.
size
();
i
++
)
if
(
name
[
i
]
==
' '
)
name
[
i
]
=
'_'
;
return
name
;
}
int
GModel
::
writeUNV
(
const
std
::
string
&
name
,
bool
saveAll
,
bool
saveGroupsOfNodes
,
int
GModel
::
writeUNV
(
const
std
::
string
&
name
,
bool
saveAll
,
bool
saveGroupsOfNodes
,
double
scalingFactor
)
double
scalingFactor
)
{
{
...
@@ -202,36 +216,30 @@ int GModel::writeUNV(const std::string &name, bool saveAll, bool saveGroupsOfNod
...
@@ -202,36 +216,30 @@ int GModel::writeUNV(const std::string &name, bool saveAll, bool saveGroupsOfNod
// elements
// elements
fprintf
(
fp
,
"%6d
\n
"
,
-
1
);
fprintf
(
fp
,
"%6d
\n
"
,
-
1
);
fprintf
(
fp
,
"%6d
\n
"
,
2412
);
fprintf
(
fp
,
"%6d
\n
"
,
2412
);
int
num
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
entities
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
entities
.
size
();
i
++
){
if
(
saveAll
||
entities
[
i
]
->
physicals
.
size
()){
for
(
unsigned
int
j
=
0
;
j
<
entities
[
i
]
->
getNumMeshElements
();
j
++
){
for
(
unsigned
int
j
=
0
;
j
<
entities
[
i
]
->
getNumMeshElements
();
j
++
){
MElement
*
e
=
entities
[
i
]
->
getMeshElement
(
j
);
MElement
*
e
=
entities
[
i
]
->
getMeshElement
(
j
);
// FIXME: don't duplicate elements anymore: just save the element with
e
->
writeUNV
(
fp
,
e
->
getNum
(),
entities
[
i
]
->
tag
(),
0
);
// their natural id
}
if
(
saveAll
)
e
->
writeUNV
(
fp
,
++
num
,
entities
[
i
]
->
tag
(),
0
);
else
for
(
unsigned
int
k
=
0
;
k
<
entities
[
i
]
->
physicals
.
size
();
k
++
)
e
->
writeUNV
(
fp
,
++
num
,
entities
[
i
]
->
tag
(),
entities
[
i
]
->
physicals
[
k
]);
}
}
}
}
fprintf
(
fp
,
"%6d
\n
"
,
-
1
);
fprintf
(
fp
,
"%6d
\n
"
,
-
1
);
// FIXME: save groups of elements for each physical
std
::
map
<
int
,
std
::
vector
<
GEntity
*>
>
groups
[
4
];
getPhysicalGroups
(
groups
);
// groups of
nodes for physical groups
//
save
groups of
elements (and groups of nodes if requested) for each
if
(
saveGroupsOfNodes
){
// physical
fprintf
(
fp
,
"%6d
\n
"
,
-
1
);
fprintf
(
fp
,
"%6d
\n
"
,
-
1
);
fprintf
(
fp
,
"%6d
\n
"
,
2477
);
fprintf
(
fp
,
"%6d
\n
"
,
2477
);
std
::
map
<
int
,
std
::
vector
<
GEntity
*>
>
groups
[
4
];
for
(
int
dim
=
0
;
dim
<=
3
;
dim
++
){
getPhysicalGroups
(
groups
);
int
gr
=
1
;
for
(
int
dim
=
1
;
dim
<=
3
;
dim
++
){
for
(
std
::
map
<
int
,
std
::
vector
<
GEntity
*>
>::
iterator
it
=
groups
[
dim
].
begin
();
for
(
std
::
map
<
int
,
std
::
vector
<
GEntity
*>
>::
iterator
it
=
groups
[
dim
].
begin
();
it
!=
groups
[
dim
].
end
();
it
++
){
it
!=
groups
[
dim
].
end
();
it
++
){
std
::
set
<
MVertex
*>
nodes
;
std
::
vector
<
GEntity
*>
&
entities
=
it
->
second
;
std
::
vector
<
GEntity
*>
&
entities
=
it
->
second
;
std
::
set
<
MVertex
*>
nodes
;
if
(
saveGroupsOfNodes
){
for
(
unsigned
int
i
=
0
;
i
<
entities
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
entities
.
size
();
i
++
){
for
(
unsigned
int
j
=
0
;
j
<
entities
[
i
]
->
getNumMeshElements
();
j
++
){
for
(
unsigned
int
j
=
0
;
j
<
entities
[
i
]
->
getNumMeshElements
();
j
++
){
MElement
*
e
=
entities
[
i
]
->
getMeshElement
(
j
);
MElement
*
e
=
entities
[
i
]
->
getMeshElement
(
j
);
...
@@ -239,9 +247,17 @@ int GModel::writeUNV(const std::string &name, bool saveAll, bool saveGroupsOfNod
...
@@ -239,9 +247,17 @@ int GModel::writeUNV(const std::string &name, bool saveAll, bool saveGroupsOfNod
nodes
.
insert
(
e
->
getVertex
(
k
));
nodes
.
insert
(
e
->
getVertex
(
k
));
}
}
}
}
}
int
nele
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
entities
.
size
();
i
++
)
nele
+=
entities
[
i
]
->
getNumMeshElements
();
fprintf
(
fp
,
"%10d%10d%10d%10d%10d%10d%10d%10d
\n
"
,
fprintf
(
fp
,
"%10d%10d%10d%10d%10d%10d%10d%10d
\n
"
,
gr
,
0
,
0
,
0
,
0
,
0
,
0
,
(
int
)
nodes
.
size
());
it
->
first
,
0
,
0
,
0
,
0
,
0
,
0
,
(
int
)
nodes
.
size
()
+
nele
);
fprintf
(
fp
,
"PERMANENT GROUP%d
\n
"
,
gr
++
);
fprintf
(
fp
,
"%s
\n
"
,
physicalName
(
this
,
dim
,
it
->
first
).
c_str
());
if
(
saveGroupsOfNodes
){
int
row
=
0
;
int
row
=
0
;
for
(
std
::
set
<
MVertex
*>::
iterator
it2
=
nodes
.
begin
();
it2
!=
nodes
.
end
();
it2
++
){
for
(
std
::
set
<
MVertex
*>::
iterator
it2
=
nodes
.
begin
();
it2
!=
nodes
.
end
();
it2
++
){
if
(
row
==
2
)
{
if
(
row
==
2
)
{
...
@@ -253,6 +269,22 @@ int GModel::writeUNV(const std::string &name, bool saveAll, bool saveGroupsOfNod
...
@@ -253,6 +269,22 @@ int GModel::writeUNV(const std::string &name, bool saveAll, bool saveGroupsOfNod
}
}
fprintf
(
fp
,
"
\n
"
);
fprintf
(
fp
,
"
\n
"
);
}
}
{
int
row
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
entities
.
size
();
i
++
){
for
(
unsigned
int
j
=
0
;
j
<
entities
[
i
]
->
getNumMeshElements
();
j
++
){
MElement
*
e
=
entities
[
i
]
->
getMeshElement
(
j
);
if
(
row
==
2
)
{
fprintf
(
fp
,
"
\n
"
);
row
=
0
;
}
fprintf
(
fp
,
"%10d%10d%10d%10d"
,
8
,
e
->
getNum
(),
0
,
0
);
row
++
;
}
}
fprintf
(
fp
,
"
\n
"
);
}
}
}
fprintf
(
fp
,
"%6d
\n
"
,
-
1
);
fprintf
(
fp
,
"%6d
\n
"
,
-
1
);
}
}
...
...
This diff is collapsed.
Click to expand it.
doc/VERSIONS.txt
+
3
−
0
View file @
07b3cae7
2.7.1: updated onelab; better Abaqus and UNV export; small bug and compilation
fixes.
2.7.0 (March 9, 2013): new single-window GUI, with dynamically customizable
2.7.0 (March 9, 2013): new single-window GUI, with dynamically customizable
widget tree; faster STEP/BRep import; arbitrary size image export; faster 2D
widget tree; faster STEP/BRep import; arbitrary size image export; faster 2D
Delaunay/Frontal algorithms; full option viewer/editor; many bug fixes.
Delaunay/Frontal algorithms; full option viewer/editor; many bug fixes.
...
...
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