1919# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
2020# SOFTWARE. 
2121
22- import  os , sys , platform 
23- if  sys .version_info  >=  (3 ,8 ,0 ) and  platform .system () ==  "Windows" :
22+ import  os 
23+ import  sys 
24+ import  platform 
25+ if  sys .version_info  >=  (3 , 8 , 0 ) and  platform .system () ==  "Windows" :
2426    for  path  in  [x .strip () for  x  in  os .environ ['PATH' ].split (';' ) if  x ]:
2527        os .add_dll_directory (path )
2628
2729import  opengeode  as  geode 
2830import  opengeode_inspector_py_inspector  as  inspector 
2931
32+ 
3033def  check_non_colocation2D ():
3134    curve  =  geode .EdgedCurve2D .create ()
32-     builder  =  geode .EdgedCurveBuilder2D .create (  curve   )
33-     builder .create_vertices (  4   )
34-     builder .set_point (  0 , geode .Point2D ( [  0. , 2.  ] )  )
35-     builder .set_point (  1 , geode .Point2D ( [  2. , 0.  ] )  )
36-     builder .set_point (  2 , geode .Point2D ( [  1. , 4.  ] )  )
37-     builder .set_point (  3 , geode .Point2D ( [  3. , 3.  ] )  )
38- 
39-     colocation_inspector  =  inspector .EdgedCurveColocation2D  (  curve   )
35+     builder  =  geode .EdgedCurveBuilder2D .create (curve )
36+     builder .create_vertices (4 )
37+     builder .set_point (0 , geode .Point2D ([ 0. , 2. ]) )
38+     builder .set_point (1 , geode .Point2D ([ 2. , 0. ]) )
39+     builder .set_point (2 , geode .Point2D ([ 1. , 4. ]) )
40+     builder .set_point (3 , geode .Point2D ([ 3. , 3. ]) )
41+ 
42+     colocation_inspector  =  inspector .EdgedCurveColocation2D ( curve )
4043    if  colocation_inspector .mesh_has_colocated_points ():
41-         raise  ValueError ( "[Test] EdgedCurve has colocated points when it should have none."  )
44+         raise  ValueError (
45+             "[Test] EdgedCurve has colocated points when it should have none." )
4246    if  not  colocation_inspector .nb_colocated_points () ==  0 :
43-         raise  ValueError ( "[Test] EdgedCurve has more colocated points than it should."  )
47+         raise  ValueError (
48+             "[Test] EdgedCurve has more colocated points than it should." )
4449    if  colocation_inspector .colocated_points_groups ():
45-         raise  ValueError ( "[Test] EdgedCurve points are shown colocated whereas they are not."  )
50+         raise  ValueError (
51+             "[Test] EdgedCurve points are shown colocated whereas they are not." )
52+ 
4653
4754def  check_colocation2D ():
4855    curve  =  geode .EdgedCurve2D .create ()
49-     builder  =  geode .EdgedCurveBuilder2D .create (  curve   )
50-     builder .create_vertices (  7   )
51-     builder .set_point (  0 , geode .Point2D ( [  0. , 2.  ] )  )
52-     builder .set_point (  1 , geode .Point2D ( [  0. , 2.  ] )  )
53-     builder .set_point (  2 , geode .Point2D ( [  0. , 0.  ] )  )
54-     builder .set_point (  3 , geode .Point2D ( [  2. , 0.  ] )  )
55-     builder .set_point (  4 , geode .Point2D ( [  1. , 4.  ] )  )
56-     builder .set_point (  5 , geode .Point2D ( [  2. , geode .global_epsilon  /  2  ] )  )
57-     builder .set_point (  6 , geode .Point2D ( [  geode .global_epsilon  /  1.1 , 2.  ] )  )
58- 
59-     colocation_inspector  =  inspector .EdgedCurveColocation2D  (  curve   )
56+     builder  =  geode .EdgedCurveBuilder2D .create (curve )
57+     builder .create_vertices (7 )
58+     builder .set_point (0 , geode .Point2D ([ 0. , 2. ]) )
59+     builder .set_point (1 , geode .Point2D ([ 0. , 2. ]) )
60+     builder .set_point (2 , geode .Point2D ([ 0. , 0. ]) )
61+     builder .set_point (3 , geode .Point2D ([ 2. , 0. ]) )
62+     builder .set_point (4 , geode .Point2D ([ 1. , 4. ]) )
63+     builder .set_point (5 , geode .Point2D ([ 2. , geode .global_epsilon  /  2 ]) )
64+     builder .set_point (6 , geode .Point2D ([ geode .global_epsilon  /  1.1 , 2. ]) )
65+ 
66+     colocation_inspector  =  inspector .EdgedCurveColocation2D ( curve )
6067    if  not  colocation_inspector .mesh_has_colocated_points ():
61-         raise  ValueError ( "[Test] EdgedCurve doesn't have colocated points whereas it should have several."  )
68+         raise  ValueError (
69+             "[Test] EdgedCurve doesn't have colocated points whereas it should have several." )
6270    if  not  colocation_inspector .nb_colocated_points () ==  5 :
63-         raise  ValueError ( "[Test] EdgedCurve has wrong number of colocated points."  )
64-     first_colocated_points_group  =  [ 0 , 1 , 6  ]
71+         raise  ValueError (
72+             "[Test] EdgedCurve has wrong number of colocated points." )
73+     first_colocated_points_group  =  [0 , 1 , 6 ]
6574    if  not  colocation_inspector .colocated_points_groups ()[0 ] ==  first_colocated_points_group :
66-         raise  ValueError ( "[Test] EdgedCurve has wrong first colocated points group."  )
67-     second_colocated_points_group  =  [ 3 , 5  ]
75+         raise  ValueError (
76+             "[Test] EdgedCurve has wrong first colocated points group." )
77+     second_colocated_points_group  =  [3 , 5 ]
6878    if  not  colocation_inspector .colocated_points_groups ()[1 ] ==  second_colocated_points_group :
69-         raise  ValueError ( "[Test] EdgedCurve has wrong second colocated points group."  )
79+         raise  ValueError (
80+             "[Test] EdgedCurve has wrong second colocated points group." )
81+ 
7082
7183def  check_non_colocation3D ():
7284    curve  =  geode .EdgedCurve3D .create ()
73-     builder  =  geode .EdgedCurveBuilder3D .create (  curve   )
74-     builder .create_vertices (  4   )
75-     builder .set_point (  0 , geode .Point3D ( [  0. , 2. , 0.  ] )  )
76-     builder .set_point (  1 , geode .Point3D ( [  2. , 0. , 0.5  ] )  )
77-     builder .set_point (  2 , geode .Point3D ( [  1. , 4. , 1.  ] )  )
78-     builder .set_point (  3 , geode .Point3D ( [  3. , 3. , 2.  ] )  )
79- 
80-     colocation_inspector  =  inspector .EdgedCurveColocation3D  (  curve   )
85+     builder  =  geode .EdgedCurveBuilder3D .create (curve )
86+     builder .create_vertices (4 )
87+     builder .set_point (0 , geode .Point3D ([ 0. , 2. , 0. ]) )
88+     builder .set_point (1 , geode .Point3D ([ 2. , 0. , 0.5 ]) )
89+     builder .set_point (2 , geode .Point3D ([ 1. , 4. , 1. ]) )
90+     builder .set_point (3 , geode .Point3D ([ 3. , 3. , 2. ]) )
91+ 
92+     colocation_inspector  =  inspector .EdgedCurveColocation3D ( curve )
8193    if  colocation_inspector .mesh_has_colocated_points ():
82-         raise  ValueError ( "[Test] (3D) EdgedCurve has colocated points when it should have none."  )
94+         raise  ValueError (
95+             "[Test] (3D) EdgedCurve has colocated points when it should have none." )
8396    if  not  colocation_inspector .nb_colocated_points () ==  0 :
84-         raise  ValueError ( "[Test] (3D) EdgedCurve has more colocated points than it should."  )
97+         raise  ValueError (
98+             "[Test] (3D) EdgedCurve has more colocated points than it should." )
8599    if  colocation_inspector .colocated_points_groups ():
86-         raise  ValueError ( "[Test] (3D) EdgedCurve points are shown colocated whereas they are not."  )
100+         raise  ValueError (
101+             "[Test] (3D) EdgedCurve points are shown colocated whereas they are not." )
102+ 
87103
88104def  check_colocation3D ():
89105    curve  =  geode .EdgedCurve3D .create ()
90-     builder  =  geode .EdgedCurveBuilder3D .create (  curve   )
91-     builder .create_vertices (  7   )
92-     builder .set_point (  0 , geode .Point3D ( [  0. , 2. , 1.  ] )  )
93-     builder .set_point (  1 , geode .Point3D ( [  0. , 2. , 1.  ] )  )
94-     builder .set_point (  2 , geode .Point3D ( [  0. , 0. , 0.  ] )  )
95-     builder .set_point (  3 , geode .Point3D ( [  2. , 0. , 0.  ] )  )
96-     builder .set_point (  4 , geode .Point3D ( [  1. , 4. , 3.  ] )  )
106+     builder  =  geode .EdgedCurveBuilder3D .create (curve )
107+     builder .create_vertices (7 )
108+     builder .set_point (0 , geode .Point3D ([ 0. , 2. , 1. ]) )
109+     builder .set_point (1 , geode .Point3D ([ 0. , 2. , 1. ]) )
110+     builder .set_point (2 , geode .Point3D ([ 0. , 0. , 0. ]) )
111+     builder .set_point (3 , geode .Point3D ([ 2. , 0. , 0. ]) )
112+     builder .set_point (4 , geode .Point3D ([ 1. , 4. , 3. ]) )
97113    builder .set_point (
98-         5 , geode .Point3D ( [  2. , geode .global_epsilon  /  2 , geode .global_epsilon  /  2  ] )  )
99-     builder .set_point (  6 , geode .Point3D ( [  geode .global_epsilon  /  1.1 , 2. , 1.  ] )  )
114+         5 , geode .Point3D ([ 2. , geode .global_epsilon  /  2 , geode .global_epsilon  /  2 ]) )
115+     builder .set_point (6 , geode .Point3D ([ geode .global_epsilon  /  1.1 , 2. , 1. ]) )
100116
101-     colocation_inspector  =  inspector .EdgedCurveColocation3D  (  curve   )
117+     colocation_inspector  =  inspector .EdgedCurveColocation3D ( curve )
102118    if  not  colocation_inspector .mesh_has_colocated_points ():
103-         raise  ValueError ( "[Test] (3D) EdgedCurve doesn't have colocated points whereas it should have several."  )
119+         raise  ValueError (
120+             "[Test] (3D) EdgedCurve doesn't have colocated points whereas it should have several." )
104121    if  not  colocation_inspector .nb_colocated_points () ==  5 :
105-         raise  ValueError ( "[Test] (3D) EdgedCurve has wrong number of colocated points."  )
106-     first_colocated_points_group  =  [ 0 , 1 , 6  ]
122+         raise  ValueError (
123+             "[Test] (3D) EdgedCurve has wrong number of colocated points." )
124+     first_colocated_points_group  =  [0 , 1 , 6 ]
107125    if  not  colocation_inspector .colocated_points_groups ()[0 ] ==  first_colocated_points_group :
108-         raise  ValueError ( "[Test] (3D) EdgedCurve has wrong first colocated points group."  )
109-     second_colocated_points_group  =  [ 3 , 5  ]
126+         raise  ValueError (
127+             "[Test] (3D) EdgedCurve has wrong first colocated points group." )
128+     second_colocated_points_group  =  [3 , 5 ]
110129    if  not  colocation_inspector .colocated_points_groups ()[1 ] ==  second_colocated_points_group :
111-         raise  ValueError ( "[Test] (3D) EdgedCurve has wrong second colocated points group."  )
130+         raise  ValueError (
131+             "[Test] (3D) EdgedCurve has wrong second colocated points group." )
132+ 
112133
113134if  __name__  ==  '__main__' :
135+     inspector .OpenGeodeInspectorInspector .initialize ()
114136    check_non_colocation2D ()
115137    check_colocation2D ()
116138    check_non_colocation3D ()
117-     check_colocation3D ()
139+     check_colocation3D ()
0 commit comments