Debian Codegraph @

test/testAGL/testVTK_IO.cc

raw
1 /*
2 * Advanced Simulation Library <http://asl.org.il>
3 *
4 * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
5 *
6 *
7 * This file is part of Advanced Simulation Library (ASL).
8 *
9 * ASL is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU Affero General Public License as
11 * published by the Free Software Foundation, version 3 of the License.
12 *
13 * ASL is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with ASL. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23
24 /**
25 \example testVTK_IO.cc
26 Required input file: [bus.stl](http://asl.org.il/input_data/bus.stl)
27 */
28
29 #include "writers/aslVTKFormatWriters.h"
30 #include "readers/aslVTKFormatReaders.h"
31 #include "aslGenerators.h"
32 #include "num/aslDataResampling.h"
33 #include "data/aslDataWithGhostNodes.h"
34
35 void testMINC()
36 {
37 cout << "Test of MINC files reader..." << endl;
38
39 auto data(asl::read("subject04_crisp_v.mnc", 0));
40
41 asl::writeVTKXML("data.vti",
42 *data,
43 "data");
44 }
45
46 void testMINCplus()
47 {
48 cout << "Test of MINC files reader +..." << endl;
49
50 auto data(asl::read("subject04_crisp_v.mnc", 0));
51
52 asl::DataCoarser dc(data);
53 dc.init();
54 dc.execute();
55 asl::writeVTKXML("dataCoarsed.vti",
56 *dc.getDataOut(),
57 "data");
58
59 }
60
61 void testSurfaceSTL()
62 {
63 cout << "Test of Surface STL files reader..." << endl;
64
65 // INPUT_DATA_DIR will be expanded by the preprocessor to e.g. "/path/to/dir/"
66 // and the compiler will merge adjacent string literals
67 // alternatively `bus.stl` can be copied to the test directory
68 // by cmake (configure_file() for a configuration time copy or add_custom_command() for a build time copy)
69 auto data(asl::readSurface(INPUT_DATA_DIR "bus.stl", 5));
70 // auto data(asl::readSurface("xx.vtp", .01));
71
72 asl::writeVTKXML("dataSurfaceSTL.vti",
73 *data,
74 "data");
75 }
76
77
78
79 int main()
80 {
81 // testMINC();
82 // testMINCplus();
83 testSurfaceSTL();
84 return 0;
85 }