EGSnrc C++ class library  Report PIRS-898 (2021)
Iwan Kawrakow, Ernesto Mainegra-Hing, Frederic Tessier, Reid Townson and Blake Walters
test_geometry.cpp
Go to the documentation of this file.
1 /*
2 ###############################################################################
3 #
4 # EGSnrc egs++ geometry testing utility
5 # Copyright (C) 2015 National Research Council Canada
6 #
7 # This file is part of EGSnrc.
8 #
9 # EGSnrc is free software: you can redistribute it and/or modify it under
10 # the terms of the GNU Affero General Public License as published by the
11 # Free Software Foundation, either version 3 of the License, or (at your
12 # option) any later version.
13 #
14 # EGSnrc is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 # FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
17 # more details.
18 #
19 # You should have received a copy of the GNU Affero General Public License
20 # along with EGSnrc. If not, see <http://www.gnu.org/licenses/>.
21 #
22 ###############################################################################
23 #
24 # Author: Iwan Kawrakow, 2005
25 #
26 # Contributors:
27 #
28 ###############################################################################
29 */
30 
31 
41 #include "egs_base_geometry.h"
42 #include "egs_geometry_tester.h"
43 #include "egs_input.h"
44 #include "egs_functions.h"
45 
46 #include <iostream>
47 using namespace std;
48 
49 int main(int argc, char **argv) {
50 
51  if (argc < 2) {
52  egsFatal("Usage: %s input_file\n",argv[0]);
53  }
54 
55  EGS_Input input;
56  input.setContentFromFile(argv[1]);
57  //input.print(0,cout);
59  if (!g) {
60  egsFatal("\nGot a null geometry? Check your input file\n\n");
61  }
63 
65 
66  tester->testInside(g);
67  tester->testInsideTime(g);
68  tester->testHownear(20,g);
69  tester->testHownearTime(g);
70  tester->testHowfar(g);
71  tester->testHowfarTime(g);
72 
73  delete tester;
74 
75  return 0;
76 
77 }
EGS_GeometryTester class header file.
A class for testing geometries.
int main(int argc, char **argv)
A main program for egspp applications.
Definition: egspp.cpp:58
void testHownear(int ntry, EGS_BaseGeometry *g)
Performs a hownear test.
int setContentFromFile(const char *fname)
Set the property from the input file fname (which is considered to be an absolute file name) ...
Definition: egs_input.cpp:200
void testInsideTime(EGS_BaseGeometry *)
Performs an inside time test.
EGS_Input class header file.
Global egspp functions header file.
Base geometry class. Every geometry class must be derived from EGS_BaseGeometry.
void testHowfarTime(EGS_BaseGeometry *)
Performs a howfar time test.
EGS_InfoFunction EGS_EXPORT egsFatal
Always use this function for reporting fatal errors.
static EGS_GeometryTester * getGeometryTester(EGS_Input *i)
Creates a geometry tester object from the input i.
static void describeGeometries()
Describes all existing geometries.
void testHownearTime(EGS_BaseGeometry *)
Performs a hownear time test.
static EGS_BaseGeometry * createGeometry(EGS_Input *)
Create a geometry (or geometries) from a given input.
A class for storing information in a tree-like structure of key-value pairs. This class is used throu...
Definition: egs_input.h:182
void testHowfar(EGS_BaseGeometry *)
Performs a howfar test.
EGS_BaseGeometry class header file.
void testInside(EGS_BaseGeometry *g)
Performs an inside test.