gctl_toolkits/archive/gmshset/main.cpp
2024-09-10 20:25:18 +08:00

48 lines
1.0 KiB
C++

#include "func.h"
void disp_help()
{
cout<<"gmshset 0.1 - set Gmsh .msh file for physical modeling"<<endl<<endl
<<"syntax: gmshset <filename> <output name> p<physical group>d<data value> [p<physical group>d<data value> ...]"<<endl;
}
int main(int argc, char* argv[])
{
char* inputname;
char* outputname;
int* p_type = NULL;
double* d_value = NULL;
if (argc <= 3)
{
disp_help();
}
else
{
inputname = argv[1];
outputname = argv[2];
p_type = new int [argc-3];
d_value = new double [argc-3];
for (int i = 0; i < argc - 3; ++i)
{
if(2!=sscanf(argv[i+3],"p%dd%lf",&p_type[i],&d_value[i]))
{
cout<<argv[i+3]<<" not recognized!"<<endl;
if(p_type!=NULL) delete[] p_type;
if(d_value!=NULL) delete[] d_value;
return 1;
}
}
MshSet meshone;
meshone.init();
if (!meshone.readmsh(inputname))
{
meshone.outmsh(inputname,outputname,p_type,d_value,argc-3);
meshone.relese_node_id();
}
}
if(p_type!=NULL) delete[] p_type;
if(d_value!=NULL) delete[] d_value;
return 0;
}