@@ -17,8 +17,8 @@ class comp:
1717 Mesh = type (None )
1818try :
1919 from numba import jit
20- numba = True
21- except :
20+ numba = True
21+ except : # pylint: disable=bare-except
2222 jit = None
2323 numba = False
2424
@@ -28,7 +28,10 @@ class comp:
2828
2929if numba :
3030 @jit (nopython = True , cache = True )
31- def build2DCells (coordinates , sIndicies , cell_indicies , start_end , vStart ):
31+ def build2DCells (coordinates , sIndicies , cell_indicies , start_end ):
32+ """
33+ JIT Method used to construct 2D cells
34+ """
3235 cStart = start_end [0 ]
3336 cEnd = start_end [1 ]
3437 cells = np .zeros ((cell_indicies .shape [0 ], 3 ))
@@ -50,7 +53,10 @@ def build2DCells(coordinates, sIndicies, cell_indicies, start_end, vStart):
5053 return cells
5154
5255 @jit (nopython = True , cache = True )
53- def build3DCells (coordinates , sIndicies , cell_indicies , start_end , vStart ):
56+ def build3DCells (coordinates , sIndicies , cell_indicies , start_end ):
57+ """
58+ JIT Method used to construct 3D cells
59+ """
5460 cStart = start_end [0 ]
5561 cEnd = start_end [1 ]
5662 cells = np .zeros ((cell_indicies .shape [0 ], 4 ))
@@ -76,7 +82,10 @@ def build3DCells(coordinates, sIndicies, cell_indicies, start_end, vStart):
7682 raise RuntimeError ("We only support tets." )
7783 return cells
7884else :
79- def build2DCells (coordinates , sIndicies , cell_indicies , start_end , vStart ):
85+ def build2DCells (coordinates , sIndicies , cell_indicies , start_end ):
86+ """
87+ Method used to construct 2D cells
88+ """
8089 cStart = start_end [0 ]
8190 cEnd = start_end [1 ]
8291 cells = np .zeros ((cell_indicies .shape [0 ], 3 ))
@@ -97,7 +106,10 @@ def build2DCells(coordinates, sIndicies, cell_indicies, start_end, vStart):
97106 raise RuntimeError ("We only support triangles." )
98107 return cells
99108
100- def build3DCells (coordinates , sIndicies , cell_indicies , start_end , vStart ):
109+ def build3DCells (coordinates , sIndicies , cell_indicies , start_end ):
110+ """
111+ Method used to construct 3D cells
112+ """
101113 cStart = start_end [0 ]
102114 cEnd = start_end [1 ]
103115 cells = np .zeros ((cell_indicies .shape [0 ], 4 ))
@@ -124,16 +136,25 @@ def build3DCells(coordinates, sIndicies, cell_indicies, start_end, vStart):
124136 return cells
125137
126138def create2DNetgenMesh (ngMesh , coordinates , plex , geoInfo ):
139+ """
140+ Method used to generate 2D NetgenMeshes
141+
142+ :arg ngMesh: the netgen mesh to be populated
143+ :arg coordinates: vertices coordinates
144+ :arg plex: PETSc DMPlex
145+ :arg geoInfo: geometric information assosciated with the Netgen mesh
146+
147+ """
127148 ngMesh .AddPoints (coordinates )
128149 cStart ,cEnd = plex .getHeightStratum (0 )
129150 vStart , _ = plex .getHeightStratum (2 )
130151 # Outside of jitted loop we put all calls to plex
131152 sIndicies = [plex .getCone (i ) for i in range (cStart ,cEnd )]
132- cells_indicies = np .vstack ([np .hstack ([plex .getCone (sIndex [k ])- vStart
153+ cells_indicies = np .vstack ([np .hstack ([plex .getCone (sIndex [k ])- vStart
133154 for k in range (len (sIndex ))]) for sIndex in sIndicies ])
134155 ngMesh .Add (ngm .FaceDescriptor (bc = 1 ))
135156 cells = build2DCells (coordinates , sIndicies ,
136- cells_indicies , (cStart , cEnd ), vStart )
157+ cells_indicies , (cStart , cEnd ))
137158 if cells .ndim == 2 :
138159 ngMesh .AddElements (dim = 2 , index = 1 , data = cells , base = 0 )
139160 for bcLabel in range (1 ,plex .getLabelSize (FACE_SETS_LABEL )+ 1 ):
@@ -149,22 +170,30 @@ def create2DNetgenMesh(ngMesh, coordinates, plex, geoInfo):
149170 ngMesh .Add (edge , project_geominfo = geoInfo )
150171
151172def create3DNetgenMesh (ngMesh , coordinates , plex , geoInfo ):
173+ """
174+ Method used to generate 3D NetgenMeshes
175+
176+ :arg ngMesh: the netgen mesh to be populated
177+ :arg coordinates: vertices coordinates
178+ :arg plex: PETSc DMPlex
179+ :arg geoInfo: geometric information assosciated with the Netgen mesh
180+
181+ """
152182 ngMesh .AddPoints (coordinates )
153183 cStart , cEnd = plex .getHeightStratum (0 )
154184 vStart , _ = plex .getHeightStratum (3 )
155185 # Outside of jitted loop we put all calls to plex
156186 sIndicies = [plex .getCone (i ) for i in range (cStart ,cEnd )]
157-
158187 f1Indicies = np .array ([plex .getCone (s [0 ]) for s in sIndicies ])
159188 f2Indicies = np .array ([plex .getCone (s [1 ]) for s in sIndicies ])
160189 fIndicies = np .hstack ([f1Indicies ,f2Indicies ])
161190
162- cells_indicies = np .vstack ([np .hstack ([plex .getCone (sIndex [k ])- vStart
191+ cells_indicies = np .vstack ([np .hstack ([plex .getCone (sIndex [k ])- vStart
163192 for k in range (len (sIndex ))]) for sIndex in fIndicies ])
164193 ngMesh .Add (ngm .FaceDescriptor (bc = 1 ))
165194 ngMesh .Add (ngm .FaceDescriptor (bc = plex .getLabelSize (FACE_SETS_LABEL )+ 1 ))
166195 cells = build3DCells (coordinates , sIndicies ,
167- cells_indicies , (cStart , cEnd ), vStart )
196+ cells_indicies , (cStart , cEnd ))
168197 if cells .ndim == 2 :
169198 ngMesh .AddElements (dim = 3 , index = plex .getLabelSize (FACE_SETS_LABEL )+ 1 ,
170199 data = cells , base = 0 )
0 commit comments