File tree 2 files changed +56
-0
lines changed
2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change
1
+ include ../Makefile.in
2
+ include ../TMR_Common.mk
3
+
4
+ OBJS = bstltostl.o
5
+
6
+ default : ${OBJS}
7
+ ${CXX} bstltostl.o ${TMR_LD_FLAGS} -o bstltostl
8
+
9
+ clean :
10
+ rm -rf bstltostl * .o
Original file line number Diff line number Diff line change
1
+ #include "TMRBase.h"
2
+ #include "TMR_STLTools.h"
3
+
4
+ /*
5
+ This is a conversion tool that converts the output .bstl file (which
6
+ is the results of a parallel I/O and is in bindary) to a regular
7
+ .stl file.
8
+ */
9
+ int main ( int argc , char * argv [] ){
10
+ MPI_Init (& argc , & argv );
11
+ TMRInitialize ();
12
+
13
+ // Convert the extension (if any) on the input file to a .stl
14
+ // extension since this will convert successful
15
+ if (argc == 1 ){
16
+ fprintf (stderr , "Error, no input files\n" );
17
+ return (1 );
18
+ }
19
+
20
+ char * infile = new char [ strlen (argv [1 ])+ 1 ];
21
+ strcpy (infile , argv [1 ]);
22
+
23
+ // Set the output file
24
+ char * outfile = new char [ strlen (infile )+ 5 ];
25
+ int len = strlen (infile );
26
+ int i = len - 1 ;
27
+ for ( ; i >= 0 ; i -- ){
28
+ if (infile [i ] == '.' ){ break ; }
29
+ }
30
+ if (i == 0 ){
31
+ i = len - 1 ;
32
+ }
33
+ strcpy (outfile , infile );
34
+ strcpy (& outfile [i ], ".stl" );
35
+
36
+ if (strcmp (infile , outfile ) != 0 ){
37
+ TMR_ConvertBinToSTL (infile , outfile );
38
+ }
39
+
40
+ delete [] infile ;
41
+ delete [] outfile ;
42
+
43
+ TMRFinalize ();
44
+ MPI_Finalize ();
45
+ return (0 );
46
+ }
You can’t perform that action at this time.
0 commit comments