initial upload
This commit is contained in:
84
archive/3dtools2msh/main.cpp
Normal file
84
archive/3dtools2msh/main.cpp
Normal file
@@ -0,0 +1,84 @@
|
||||
#include "3dtools2msh.h"
|
||||
|
||||
void disp_help()
|
||||
{
|
||||
cout<<"3dtools2msh 0.1 - convert the files of Meshtools 3D to Gmsh .msh file"<<endl<<endl
|
||||
<<"syntax: 3dtools2msh -M<mesh-file> -V<model-file> [-F<filter-value>] [-G<output-file>]"<<endl
|
||||
<<" -M Meshtools 3D's mesh file"<<endl
|
||||
<<" -V Meshtools 3D's model file"<<endl
|
||||
<<" -F filter out value, the default is 9999"<<endl
|
||||
<<" -G specify output file's name, the input model file name will be used if -G is absent"<<endl
|
||||
<<"example: 3dtools2msh -Mexample.mesh -Vexample.model -Gexample.msh"<<endl;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
string _meshname="";
|
||||
string _modelname="";
|
||||
string _mshname="";
|
||||
string temp;
|
||||
double filterNum = 9999;
|
||||
if (argc==1)
|
||||
{
|
||||
disp_help();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 1; i < argc; i++)
|
||||
{
|
||||
if (typeget(argv[i],MESH,temp))
|
||||
{
|
||||
if (temp=="")
|
||||
{
|
||||
cout<<"syntax error: "<<argv[i]<<endl;
|
||||
disp_help();
|
||||
return 0;
|
||||
}
|
||||
else _meshname=temp;
|
||||
}
|
||||
else if (typeget(argv[i],VALUE,temp))
|
||||
{
|
||||
if (temp=="")
|
||||
{
|
||||
cout<<"syntax error: "<<argv[i]<<endl;
|
||||
disp_help();
|
||||
return 0;
|
||||
}
|
||||
else _modelname=temp;
|
||||
}
|
||||
else if (typeget(argv[i],FILTER,temp))
|
||||
{
|
||||
if (temp=="")
|
||||
{
|
||||
cout<<"syntax error: "<<argv[i]<<endl;
|
||||
disp_help();
|
||||
return 0;
|
||||
}
|
||||
else filterNum=atof(temp.c_str());
|
||||
}
|
||||
else if (typeget(argv[i],OUTFILE,temp))
|
||||
{
|
||||
if (temp=="")
|
||||
{
|
||||
cout<<"syntax error: "<<argv[i]<<endl;
|
||||
disp_help();
|
||||
return 0;
|
||||
}
|
||||
else _mshname=temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
cout<<"unrecognized argument "<<argv[i]<<endl;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(_mshname=="") _mshname=_modelname+"_convert_to.msh";
|
||||
_3dtools2msh testrun;
|
||||
testrun.meshin(_meshname);
|
||||
testrun.physin(_modelname);
|
||||
testrun.findindex();
|
||||
testrun.mshout(_mshname,filterNum);
|
||||
}
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user