75 lines
1.6 KiB
C++
75 lines
1.6 KiB
C++
|
/*
|
|||
|
tetgen2gmsh: <EFBFBD><EFBFBD>ȡtetgen<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>.node\.ele\.face\.edge<EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD>Ϊ.msh<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>tetgen<EFBFBD><EFBFBD>Ȼ<EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.msh<EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>.pos<EFBFBD>ļ<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;
|
|||
|
}
|