Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Özgür Ozan Sen
ogs
Commits
d801efed
Commit
d801efed
authored
8 years ago
by
Karsten Rink
Browse files
Options
Downloads
Patches
Plain Diff
used generalised method for writing files
parent
c6533edf
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
Applications/Utils/MeshEdit/moveMeshNodes.cpp
+5
-4
5 additions, 4 deletions
Applications/Utils/MeshEdit/moveMeshNodes.cpp
MeshLib/IO/writeMeshToFile.cpp
+6
-3
6 additions, 3 deletions
MeshLib/IO/writeMeshToFile.cpp
MeshLib/IO/writeMeshToFile.h
+1
-1
1 addition, 1 deletion
MeshLib/IO/writeMeshToFile.h
with
12 additions
and
8 deletions
Applications/Utils/MeshEdit/moveMeshNodes.cpp
+
5
−
4
View file @
d801efed
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
#include
"GeoLib/AABB.h"
#include
"GeoLib/AABB.h"
#include
"MeshLib/IO/VtkIO/VtuInterface.h"
#include
"MeshLib/IO/readMeshFromFile.h"
#include
"MeshLib/IO/readMeshFromFile.h"
#include
"MeshLib/IO/writeMeshToFile.h"
#include
"MeshLib/IO/writeMeshToFile.h"
#include
"MeshLib/Mesh.h"
#include
"MeshLib/Mesh.h"
...
@@ -75,7 +74,6 @@ int main (int argc, char* argv[])
...
@@ -75,7 +74,6 @@ int main (int argc, char* argv[])
INFO
(
"Usage: %s <msh-file.msh> <keyword> [<value1>] [<value2>]"
,
INFO
(
"Usage: %s <msh-file.msh> <keyword> [<value1>] [<value2>]"
,
argv
[
0
]);
argv
[
0
]);
INFO
(
"Available keywords:"
);
INFO
(
"Available keywords:"
);
//for (std::size_t i=0; i<keywords.size(); i++)
INFO
(
INFO
(
"
\t
-ALL <value1> <value2> : changes the elevation of all mesh "
"
\t
-ALL <value1> <value2> : changes the elevation of all mesh "
"nodes by <value2> in direction <value1> [x,y,z]."
);
"nodes by <value2> in direction <value1> [x,y,z]."
);
...
@@ -209,7 +207,10 @@ int main (int argc, char* argv[])
...
@@ -209,7 +207,10 @@ int main (int argc, char* argv[])
}
}
/**** add other keywords here ****/
/**** add other keywords here ****/
MeshLib
::
IO
::
VtuInterface
vtu
(
mesh
.
get
(),
0
,
false
);
std
::
string
const
new_mesh_name
(
msh_name
.
substr
(
0
,
msh_name
.
length
()
-
4
)
+
"_new.vtu"
);
vtu
.
writeToFile
(
msh_name
.
substr
(
0
,
msh_name
.
length
()
-
4
)
+
"_new.vtu"
);
if
(
MeshLib
::
IO
::
writeMeshToFile
(
*
mesh
,
new_mesh_name
)
!=
0
)
return
EXIT_FAILURE
;
INFO
(
"Result successfully written."
)
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
}
This diff is collapsed.
Click to expand it.
MeshLib/IO/writeMeshToFile.cpp
+
6
−
3
View file @
d801efed
...
@@ -22,19 +22,22 @@ namespace MeshLib
...
@@ -22,19 +22,22 @@ namespace MeshLib
{
{
namespace
IO
namespace
IO
{
{
void
writeMeshToFile
(
const
MeshLib
::
Mesh
&
mesh
,
const
std
::
string
&
file_name
)
int
writeMeshToFile
(
const
MeshLib
::
Mesh
&
mesh
,
const
std
::
string
&
file_name
)
{
{
if
(
BaseLib
::
hasFileExtension
(
"msh"
,
file_name
))
if
(
BaseLib
::
hasFileExtension
(
"msh"
,
file_name
))
{
{
MeshLib
::
IO
::
Legacy
::
MeshIO
meshIO
;
MeshLib
::
IO
::
Legacy
::
MeshIO
meshIO
;
meshIO
.
setMesh
(
&
mesh
);
meshIO
.
setMesh
(
&
mesh
);
meshIO
.
writeToFile
(
file_name
);
meshIO
.
writeToFile
(
file_name
);
return
0
;
}
else
if
(
BaseLib
::
hasFileExtension
(
"vtu"
,
file_name
))
{
}
else
if
(
BaseLib
::
hasFileExtension
(
"vtu"
,
file_name
))
{
MeshLib
::
IO
::
VtuInterface
writer
(
&
mesh
);
MeshLib
::
IO
::
VtuInterface
writer
(
&
mesh
);
writer
.
writeToFile
(
file_name
);
writer
.
writeToFile
(
file_name
);
}
else
{
return
0
;
ERR
(
"writeMeshToFile(): Unknown mesh file format in file %s."
,
file_name
.
c_str
());
}
}
ERR
(
"writeMeshToFile(): Unknown mesh file format in file %s."
,
file_name
.
c_str
());
return
-
1
;
}
}
}
// end namespace IO
}
// end namespace IO
...
...
This diff is collapsed.
Click to expand it.
MeshLib/IO/writeMeshToFile.h
+
1
−
1
View file @
d801efed
...
@@ -16,7 +16,7 @@ namespace MeshLib
...
@@ -16,7 +16,7 @@ namespace MeshLib
class
Mesh
;
class
Mesh
;
namespace
IO
namespace
IO
{
{
void
writeMeshToFile
(
const
MeshLib
::
Mesh
&
mesh
,
const
std
::
string
&
file_name
);
int
writeMeshToFile
(
const
MeshLib
::
Mesh
&
mesh
,
const
std
::
string
&
file_name
);
}
}
}
}
...
...
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