initial upload
This commit is contained in:
75
archive/tetgen2gmsh/main.cpp
Normal file
75
archive/tetgen2gmsh/main.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
tetgen2gmsh: <20><>ȡtetgen<65>ļ<EFBFBD><C4BC><EFBFBD>.node\.ele\.face\.edge<67><65>ת<EFBFBD><D7AA>Ϊ.msh<73>ļ<EFBFBD><C4BC><EFBFBD>tetgen<65><6E>Ȼ<EFBFBD><C8BB>֧<EFBFBD><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.msh<73><68>
|
||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>.pos<6F>ļ<EFBFBD>
|
||||
*/
|
||||
|
||||
#include "tetgen2gmsh.h"
|
||||
|
||||
void disp_help()
|
||||
{
|
||||
cout<<"tetgen2gmsh 0.0.1 - convert tetgen files(.node& .edge& .face& .ele) to gmsh(.msh) file"<<endl<<endl
|
||||
<<"usage: tetgen2msh input_file [-o<output-file>]"<<endl
|
||||
<<" -o specify output file's name, the input name will be used if -o is absent"<<endl
|
||||
<<" the extensions of input and output files will be added atuomaticly"<<endl<<endl
|
||||
<<"example: tetgen2gmsh in -otest"<<endl;
|
||||
}
|
||||
|
||||
int typeget(char *str, const char* str2,string &str3)//<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD>˵<EFBFBD><CBB5>Ӿ<EFBFBD>
|
||||
{
|
||||
char* strp = strstr(str, str2); // <20><><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>str<74>в<EFBFBD><D0B2><EFBFBD>str2<72><32>
|
||||
if (strp == NULL)
|
||||
{
|
||||
return 0; // <20><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
string temp = str;
|
||||
str3=temp.substr(strlen(str2));//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>str2<72><32><EFBFBD><EFBFBD><EFBFBD>Ӿ<EFBFBD>
|
||||
return 1;
|
||||
}
|
||||
|
||||
//tetgen2gmsh p1;
|
||||
//p1.call_back();
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
string innname="";
|
||||
string outname="";
|
||||
string temp;
|
||||
if (argc==1)
|
||||
{
|
||||
disp_help();
|
||||
}
|
||||
else if (argc==2)
|
||||
{
|
||||
innname=outname=argv[1];
|
||||
tetgen2gmsh p1;
|
||||
p1.call_back(innname,outname);
|
||||
}
|
||||
else
|
||||
{
|
||||
innname=argv[1];
|
||||
for (int i = 2; i < argc; i++)
|
||||
{
|
||||
if (typeget(argv[i],OUTPUT,temp))
|
||||
{
|
||||
if (temp=="")
|
||||
{
|
||||
cout<<"no output picked, program stopped..."<<endl;
|
||||
return 0;
|
||||
}
|
||||
else outname = temp;
|
||||
}
|
||||
}
|
||||
|
||||
if (outname=="")
|
||||
{
|
||||
cout<<"no output picked, program stopped..."<<endl;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
tetgen2gmsh p1;
|
||||
p1.call_back(innname,outname);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user