Skip to content
Snippets Groups Projects
Commit 1d131ee2 authored by Tom Fischer's avatar Tom Fischer
Browse files

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
No related tags found
No related merge requests found
...@@ -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;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment