Script to generate rules cpp files, update makerlsfile.cpp

This commit is contained in:
Matthias Hochsteger 2020-02-17 15:11:25 +01:00
parent 349c79ed21
commit 88c114e999
2 changed files with 18 additions and 3 deletions

12
rules/make_all_rules.sh Executable file
View File

@ -0,0 +1,12 @@
g++ makerlsfile.cpp -o makerls
./makerls hexa.rls ../libsrc/meshing/hexarls.cpp hexrules
./makerls prisms2.rls ../libsrc/meshing/prism2rls.cpp prismrules2
./makerls pyramids.rls ../libsrc/meshing/pyramidrls.cpp pyramidrules
./makerls pyramids2.rls ../libsrc/meshing/pyramid2rls.cpp pyramidrules2
./makerls quad.rls ../libsrc/meshing/quadrls.cpp quadrules
./makerls tetra.rls ../libsrc/meshing/tetrarls.cpp tetrules
./makerls triangle.rls ../libsrc/meshing/triarls.cpp triarules
rm makerls
# node: prisms2rls is currently not used (prism2rls_2.cpp is not compiled)
# ./makerls prisms2.rls ../libsrc/meshing/prism2rls_2.cpp prismrules2

View File

@ -8,9 +8,9 @@ using namespace std;
int main (int argc, char ** argv) int main (int argc, char ** argv)
{ {
if (argc != 3) if (argc != 4)
{ {
cout << "use: makerlsfile infile outfile" << endl; cout << "use: makerlsfile infile outfile rulename" << endl;
exit(1); exit(1);
} }
@ -28,8 +28,10 @@ int main (int argc, char ** argv)
ifstream inf (argv[1]); ifstream inf (argv[1]);
ofstream outf (argv[2]); ofstream outf (argv[2]);
string rulename = argv[3];
outf << "const char * ngscript[] = {" << endl; outf << "namespace netgen" << endl << '{' << endl;
outf << "const char * " << rulename << "[] = {" << endl;
while (inf.good()) while (inf.good())
{ {
i = 0; i = 0;
@ -61,5 +63,6 @@ int main (int argc, char ** argv)
outf << "\"" << line << "\\n\",\\" << endl; outf << "\"" << line << "\\n\",\\" << endl;
} }
outf << "0};" << endl; outf << "0};" << endl;
outf << '}' << endl;
return 0; return 0;
} }