Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs-feliks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Feliks Kiszkurno
ogs-feliks
Commits
1d131ee2
Commit
1d131ee2
authored
12 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
Commented out most of the code.
If we need this tool in OGS-6, we have to reimplement it.
parent
960e3674
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Utils/FileConverter/generateMatPropsFromMatID.cpp
+46
-42
46 additions, 42 deletions
Utils/FileConverter/generateMatPropsFromMatID.cpp
with
46 additions
and
42 deletions
Utils/FileConverter/generateMatPropsFromMatID.cpp
+
46
−
42
View file @
1d131ee2
...
@@ -12,8 +12,10 @@
...
@@ -12,8 +12,10 @@
*
*
*/
*/
#include
"GridAdapter.h"
#include
<iostream>
#include
"StringTools.h"
//#include "GridAdapter.h"
//#include "StringTools.h"
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
...
@@ -21,47 +23,49 @@ int main (int argc, char* argv[])
...
@@ -21,47 +23,49 @@ int main (int argc, char* argv[])
{
{
std
::
cout
<<
"Usage: "
<<
argv
[
0
]
<<
" <msh-file>"
<<
std
::
endl
;
std
::
cout
<<
"Usage: "
<<
argv
[
0
]
<<
" <msh-file>"
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
"Creates a new file for material properties and sets the material ids in the msh-file to 0."
<<
std
::
endl
;
std
::
cout
<<
"Creates a new file for material properties and sets the material ids in the msh-file to 0."
<<
std
::
endl
;
return
-
1
;
return
-
1
;
}
else
{
std
::
cout
<<
"functionality has to be reimplemented in OGS-6"
<<
std
::
endl
;
}
}
GridAdapter
grid
(
argv
[
1
]);
//
GridAdapter grid(argv[1]);
std
::
vector
<
GridAdapter
::
Element
*>
*
elems
=
const_cast
<
std
::
vector
<
GridAdapter
::
Element
*>*
>
(
grid
.
getElements
());
//
std::vector<GridAdapter::Element*> *elems = const_cast< std::vector<GridAdapter::Element*>* >(grid.getElements());
size_t
nElems
(
elems
->
size
());
//
size_t nElems(elems->size());
//
// create file
//
// create file
std
::
string
filename
(
argv
[
1
]);
//
std::string filename(argv[1]);
std
::
string
name
=
BaseLib
::
extractBaseNameWithoutExtension
(
filename
);
//
std::string name = BaseLib::extractBaseNameWithoutExtension(filename);
//
std
::
string
new_matname
(
name
+
"_prop"
);
//
std::string new_matname(name + "_prop");
std
::
ofstream
out_prop
(
new_matname
.
c_str
(),
std
::
ios
::
out
);
//
std::ofstream out_prop( new_matname.c_str(), std::ios::out );
if
(
out_prop
.
is_open
())
//
if (out_prop.is_open())
{
//
{
for
(
size_t
i
=
0
;
i
<
nElems
;
i
++
)
//
for (size_t i=0; i<nElems; i++)
out_prop
<<
i
<<
"
\t
"
<<
(
*
elems
)[
i
]
->
material
<<
std
::
endl
;
//
out_prop << i << "\t" << (*elems)[i]->material << std::endl;
out_prop
.
close
();
//
out_prop.close();
}
//
}
else
//
else
{
//
{
std
::
cout
<<
"Error: Could not create property file..."
<<
std
::
endl
;
//
std::cout << "Error: Could not create property file..." << std::endl;
return
-
1
;
//
return -1;
}
//
}
//
// set mat ids to 0 and write new msh file
//
// set mat ids to 0 and write new msh file
for
(
size_t
i
=
0
;
i
<
nElems
;
i
++
)
//
for (size_t i=0; i<nElems; i++)
(
*
elems
)[
i
]
->
material
=
0
;
//
(*elems)[i]->material = 0;
const
MeshLib
::
CFEMesh
*
mesh
(
grid
.
getCFEMesh
());
//
const MeshLib::CFEMesh* mesh(grid.getCFEMesh());
std
::
string
new_mshname
(
name
+
"_new.msh"
);
//
std::string new_mshname(name + "_new.msh");
std
::
cout
<<
"writing mesh to file "
<<
new_mshname
<<
" ... "
<<
std
::
flush
;
//
std::cout << "writing mesh to file " << new_mshname << " ... " << std::flush;
FileIO
::
OGSMeshIO
mesh_io
;
//
FileIO::OGSMeshIO mesh_io;
mesh_io
.
setMesh
(
mesh
);
//
mesh_io.setMesh(mesh);
mesh_io
.
writeToFile
(
new_mshname
);
//
mesh_io.writeToFile (new_mshname);
std
::
cout
<<
"ok"
<<
std
::
endl
;
//
std::cout << "ok" << std::endl;
//
std
::
cout
<<
"New files
\"
"
<<
new_mshname
<<
"
\"
and
\"
"
<<
new_matname
<<
"
\"
written."
<<
std
::
endl
;
//
std::cout << "New files \"" << new_mshname << "\" and \"" << new_matname << "\" written." << std::endl;
std
::
cout
<<
"Conversion finished."
<<
std
::
endl
;
//
std::cout << "Conversion finished." << std::endl;
//
return
1
;
//
return 1;
}
}
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