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
73045745
Commit
73045745
authored
20 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
add optional node_start_index and element_start_index arguments
parent
5dfa7230
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
utils/misc/mshsort.cpp
+13
-9
13 additions, 9 deletions
utils/misc/mshsort.cpp
with
13 additions
and
9 deletions
utils/misc/mshsort.cpp
+
13
−
9
View file @
73045745
// $Id: mshsort.cpp,v 1.
4
2004-1
1-08 17:03:07
geuzaine Exp $
// $Id: mshsort.cpp,v 1.
5
2004-1
2-17 06:15:52
geuzaine Exp $
//
// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
//
...
...
@@ -201,7 +201,8 @@ double readMesh(FILE *fp, map<int, node*> &nodes, vector<element*> &elements)
return
version
;
}
void
printMesh
(
FILE
*
fp
,
double
version
,
map
<
int
,
node
*>
nodes
,
vector
<
element
*>
elements
)
void
printMesh
(
FILE
*
fp
,
double
version
,
map
<
int
,
node
*>
nodes
,
vector
<
element
*>
elements
,
int
nodeStartIndex
=
1
,
int
elementStartIndex
=
1
)
{
map
<
int
,
node
*>::
const_iterator
it
=
nodes
.
begin
();
map
<
int
,
node
*>::
const_iterator
ite
=
nodes
.
end
();
...
...
@@ -216,9 +217,8 @@ void printMesh(FILE *fp, double version, map<int, node*> nodes, vector<element*>
fprintf
(
fp
,
"$NOD
\n
"
);
fprintf
(
fp
,
"%d
\n
"
,
(
int
)
nodes
.
size
());
int
index
=
1
;
for
(;
it
!=
ite
;
++
it
){
it
->
second
->
setNum
(
i
ndex
++
);
it
->
second
->
setNum
(
nodeStartI
ndex
++
);
it
->
second
->
print
(
fp
,
version
);
}
...
...
@@ -233,7 +233,7 @@ void printMesh(FILE *fp, double version, map<int, node*> nodes, vector<element*>
fprintf
(
fp
,
"%d
\n
"
,
(
int
)
elements
.
size
());
for
(
unsigned
int
i
=
0
;
i
<
elements
.
size
();
i
++
){
elements
[
i
]
->
setNum
(
i
+
1
);
elements
[
i
]
->
setNum
(
elementStartIndex
++
);
elements
[
i
]
->
print
(
fp
,
version
);
}
...
...
@@ -245,9 +245,10 @@ void printMesh(FILE *fp, double version, map<int, node*> nodes, vector<element*>
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
<
2
||
argc
>
3
){
if
(
argc
<
2
){
fprintf
(
stderr
,
"mshsort, a utility to reorder the node and element lists in Gmsh MSH files
\n
"
);
fprintf
(
stderr
,
"Usage: %s in.msh [out.msh]
\n
"
,
argv
[
0
]);
fprintf
(
stderr
,
"Usage: %s in.msh [out.msh] [node_start_index] [element_start_index]
\n
"
,
argv
[
0
]);
exit
(
1
);
}
...
...
@@ -256,7 +257,7 @@ int main(int argc, char **argv)
fprintf
(
stderr
,
"Error: Unable to open input file '%s'
\n
"
,
argv
[
1
]);
exit
(
1
);
}
if
(
argc
=
=
3
){
if
(
argc
>
=
3
){
if
(
!
(
out
=
fopen
(
argv
[
2
],
"w"
))){
fprintf
(
stderr
,
"Error: Unable to open output file '%s'
\n
"
,
argv
[
2
]);
exit
(
1
);
...
...
@@ -265,9 +266,12 @@ int main(int argc, char **argv)
else
{
out
=
stdout
;
}
int
nodeStartIndex
=
(
argc
>=
4
)
?
atoi
(
argv
[
3
])
:
1
;
int
elementStartIndex
=
(
argc
>=
5
)
?
atoi
(
argv
[
4
])
:
1
;
map
<
int
,
node
*>
nodes
;
vector
<
element
*>
elements
;
double
version
=
readMesh
(
in
,
nodes
,
elements
);
printMesh
(
out
,
version
,
nodes
,
elements
);
printMesh
(
out
,
version
,
nodes
,
elements
,
nodeStartIndex
,
elementStartIndex
);
}
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