Skip to content

Commit e1ed3cc

Browse files
committed
renaming mesh, part I
1 parent 3a0f309 commit e1ed3cc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+149
-149
lines changed

pySDC/implementations/datatype_classes/parallel_mesh.py renamed to pySDC/implementations/datatype_classes/mesh.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
MPI = None
99

1010

11-
class parallel_mesh(np.ndarray):
11+
class mesh(np.ndarray):
1212
"""
1313
Numpy-based datatype for serial or parallel meshes.
1414
Can include a communicator and expects a dtype to allow complex data.
@@ -19,17 +19,17 @@ class parallel_mesh(np.ndarray):
1919

2020
def __new__(cls, init, val=0.0, offset=0, buffer=None, strides=None, order=None):
2121
"""
22-
Instantiates new datatype. This ensures that even when manipulating data, the result is still a parallel_mesh.
22+
Instantiates new datatype. This ensures that even when manipulating data, the result is still a mesh.
2323
2424
Args:
25-
init: either another parallel_mesh or a tuple containing the dimensions, the communicator and the dtype
25+
init: either another mesh or a tuple containing the dimensions, the communicator and the dtype
2626
val: value to initialize
2727
2828
Returns:
29-
obj of type parallel_mesh
29+
obj of type mesh
3030
3131
"""
32-
if isinstance(init, parallel_mesh):
32+
if isinstance(init, mesh):
3333
obj = np.ndarray.__new__(cls, shape=init.shape, dtype=init.dtype, buffer=buffer, offset=offset,
3434
strides=strides, order=order)
3535
obj[:] = init[:]
@@ -66,12 +66,12 @@ def __array_ufunc__(self, ufunc, method, *inputs, out=None, **kwargs):
6666
args = []
6767
comm = None
6868
for i, input_ in enumerate(inputs):
69-
if isinstance(input_, parallel_mesh):
69+
if isinstance(input_, mesh):
7070
args.append(input_.view(np.ndarray))
7171
comm = input_.comm
7272
else:
7373
args.append(input_)
74-
results = super(parallel_mesh, self).__array_ufunc__(ufunc, method, *args, **kwargs).view(parallel_mesh)
74+
results = super(mesh, self).__array_ufunc__(ufunc, method, *args, **kwargs).view(mesh)
7575
if not method == 'reduce':
7676
results._comm = comm
7777
return results
@@ -147,8 +147,8 @@ class parallel_imex_mesh(object):
147147
This data type can be used to have RHS with 2 components (here implicit and explicit)
148148
149149
Attributes:
150-
impl (parallel_mesh.parallel_mesh): implicit part
151-
expl (parallel_mesh.parallel_mesh): explicit part
150+
impl (mesh.mesh): implicit part
151+
expl (mesh.mesh): explicit part
152152
"""
153153

154154
def __init__(self, init, val=0.0):
@@ -164,12 +164,12 @@ def __init__(self, init, val=0.0):
164164
"""
165165

166166
if isinstance(init, type(self)):
167-
self.impl = parallel_mesh(init.impl)
168-
self.expl = parallel_mesh(init.expl)
167+
self.impl = mesh(init.impl)
168+
self.expl = mesh(init.expl)
169169
elif isinstance(init, tuple) and (init[1] is None or isinstance(init[1], MPI.Intracomm)) \
170170
and isinstance(init[2], np.dtype):
171-
self.impl = parallel_mesh(init, val=val)
172-
self.expl = parallel_mesh(init, val=val)
171+
self.impl = mesh(init, val=val)
172+
self.expl = mesh(init, val=val)
173173
# something is wrong, if none of the ones above hit
174174
else:
175175
raise DataError('something went wrong during %s initialization' % type(self))
@@ -180,8 +180,8 @@ class parallel_comp2_mesh(object):
180180
RHS data type for meshes with 2 components
181181
182182
Attributes:
183-
comp1 (parallel_mesh.parallel_mesh): first part
184-
comp2 (parallel_mesh.parallel_mesh): second part
183+
comp1 (mesh.mesh): first part
184+
comp2 (mesh.mesh): second part
185185
"""
186186

187187
def __init__(self, init, val=0.0):
@@ -196,12 +196,12 @@ def __init__(self, init, val=0.0):
196196
"""
197197

198198
if isinstance(init, type(self)):
199-
self.comp1 = parallel_mesh(init.comp1)
200-
self.comp2 = parallel_mesh(init.comp2)
199+
self.comp1 = mesh(init.comp1)
200+
self.comp2 = mesh(init.comp2)
201201
elif isinstance(init, tuple) and (init[1] is None or isinstance(init[1], MPI.Intracomm)) \
202202
and isinstance(init[2], np.dtype):
203-
self.comp1 = parallel_mesh(init, val=val)
204-
self.comp2 = parallel_mesh(init, val=val)
203+
self.comp1 = mesh(init, val=val)
204+
self.comp2 = mesh(init, val=val)
205205
# something is wrong, if none of the ones above hit
206206
else:
207207
raise DataError('something went wrong during %s initialization' % type(self))

pySDC/implementations/datatype_classes/particles.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import numpy as np
22

3-
from pySDC.implementations.datatype_classes.parallel_mesh import parallel_mesh
3+
from pySDC.implementations.datatype_classes.mesh import mesh
44
from pySDC.core.Errors import DataError
55

66
try:
@@ -20,10 +20,10 @@ class particles(object):
2020
vel: contains the velocities of all particles
2121
"""
2222

23-
class position(parallel_mesh):
23+
class position(mesh):
2424
pass
2525

26-
class velocity(parallel_mesh):
26+
class velocity(mesh):
2727
pass
2828

2929
def __init__(self, init=None, val=None):
@@ -204,7 +204,7 @@ def recv(self, source=None, tag=None, comm=None):
204204
return None
205205

206206

207-
class acceleration(parallel_mesh):
207+
class acceleration(mesh):
208208
pass
209209

210210

@@ -219,10 +219,10 @@ class fields(object):
219219
magn: contains the magnetic field
220220
"""
221221

222-
class electric(parallel_mesh):
222+
class electric(mesh):
223223
pass
224224

225-
class magnetic(parallel_mesh):
225+
class magnetic(mesh):
226226
pass
227227

228228
def __init__(self, init=None, val=None):

pySDC/implementations/problem_classes/AcousticAdvection_1D_FD_imex.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from pySDC.core.Errors import ParameterError
55
from pySDC.core.Problem import ptype
6-
from pySDC.implementations.datatype_classes.parallel_mesh import parallel_mesh, parallel_imex_mesh
6+
from pySDC.implementations.datatype_classes.mesh import mesh, parallel_imex_mesh
77
from pySDC.implementations.problem_classes.acoustic_helpers.buildWave1DMatrix import getWave1DMatrix, \
88
getWave1DAdvectionMatrix
99

@@ -22,7 +22,7 @@ class acoustic_1d_imex(ptype):
2222
2323
"""
2424

25-
def __init__(self, problem_params, dtype_u=parallel_mesh, dtype_f=parallel_imex_mesh):
25+
def __init__(self, problem_params, dtype_u=mesh, dtype_f=parallel_imex_mesh):
2626
"""
2727
Initialization routine
2828

pySDC/implementations/problem_classes/AdvectionDiffusionEquation_1D_FFT.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from pySDC.core.Errors import ParameterError, ProblemError
44
from pySDC.core.Problem import ptype
5-
from pySDC.implementations.datatype_classes.parallel_mesh import parallel_mesh, parallel_imex_mesh
5+
from pySDC.implementations.datatype_classes.mesh import mesh, parallel_imex_mesh
66

77

88
# noinspection PyUnusedLocal
@@ -19,7 +19,7 @@ class advectiondiffusion1d_imex(ptype):
1919
irfft_object: planned IFFT for backward transformation, real-valued output
2020
"""
2121

22-
def __init__(self, problem_params, dtype_u=parallel_mesh, dtype_f=parallel_imex_mesh):
22+
def __init__(self, problem_params, dtype_u=mesh, dtype_f=parallel_imex_mesh):
2323
"""
2424
Initialization routine
2525
@@ -134,7 +134,7 @@ class advectiondiffusion1d_implicit(advectiondiffusion1d_imex):
134134
fully-implicit time-stepping
135135
"""
136136

137-
def __init__(self, problem_params, dtype_u=parallel_mesh, dtype_f=parallel_mesh):
137+
def __init__(self, problem_params, dtype_u=mesh, dtype_f=mesh):
138138
"""
139139
Initialization routine
140140

pySDC/implementations/problem_classes/AdvectionEquation_1D_FD.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from pySDC.core.Errors import ParameterError, ProblemError
66
from pySDC.core.Problem import ptype
7-
from pySDC.implementations.datatype_classes.parallel_mesh import parallel_mesh
7+
from pySDC.implementations.datatype_classes.mesh import mesh
88

99

1010
# noinspection PyUnusedLocal
@@ -18,7 +18,7 @@ class advection1d(ptype):
1818
dx: distance between two spatial nodes
1919
"""
2020

21-
def __init__(self, problem_params, dtype_u=parallel_mesh, dtype_f=parallel_mesh):
21+
def __init__(self, problem_params, dtype_u=mesh, dtype_f=mesh):
2222
"""
2323
Initialization routine
2424

pySDC/implementations/problem_classes/AdvectionEquation_1D_FD_dirichlet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from pySDC.core.Errors import ParameterError, ProblemError
66
from pySDC.core.Problem import ptype
7-
from pySDC.implementations.datatype_classes.parallel_mesh import parallel_mesh
7+
from pySDC.implementations.datatype_classes.mesh import mesh
88

99

1010
# noinspection PyUnusedLocal
@@ -18,7 +18,7 @@ class advection1d_dirichlet(ptype):
1818
dx: distance between two spatial nodes
1919
"""
2020

21-
def __init__(self, problem_params, dtype_u=parallel_mesh, dtype_f=parallel_mesh):
21+
def __init__(self, problem_params, dtype_u=mesh, dtype_f=mesh):
2222
"""
2323
Initialization routine
2424

pySDC/implementations/problem_classes/AdvectionEquation_ND_FD_periodic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from pySDC.core.Errors import ParameterError, ProblemError
66
from pySDC.core.Problem import ptype
7-
from pySDC.implementations.datatype_classes.parallel_mesh import parallel_mesh
7+
from pySDC.implementations.datatype_classes.mesh import mesh
88

99

1010
# noinspection PyUnusedLocal
@@ -17,7 +17,7 @@ class advectionNd_periodic(ptype):
1717
A: FD discretization of the ND grad operator
1818
dx: distance between two spatial nodes (here: being the same in all dimensions)
1919
"""
20-
def __init__(self, problem_params, dtype_u=parallel_mesh, dtype_f=parallel_mesh):
20+
def __init__(self, problem_params, dtype_u=mesh, dtype_f=mesh):
2121
"""
2222
Initialization routine
2323

pySDC/implementations/problem_classes/AllenCahn_1D_FD.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from pySDC.core.Errors import ParameterError, ProblemError
77
from pySDC.core.Problem import ptype
8-
from pySDC.implementations.datatype_classes.parallel_mesh import parallel_mesh, parallel_imex_mesh, parallel_comp2_mesh
8+
from pySDC.implementations.datatype_classes.mesh import mesh, parallel_imex_mesh, parallel_comp2_mesh
99

1010

1111
class allencahn_front_fullyimplicit(ptype):
@@ -18,7 +18,7 @@ class allencahn_front_fullyimplicit(ptype):
1818
dx: distance between two spatial nodes
1919
"""
2020

21-
def __init__(self, problem_params, dtype_u=parallel_mesh, dtype_f=parallel_mesh):
21+
def __init__(self, problem_params, dtype_u=mesh, dtype_f=mesh):
2222
"""
2323
Initialization routine
2424
@@ -197,7 +197,7 @@ class allencahn_front_semiimplicit(allencahn_front_fullyimplicit):
197197
dx: distance between two spatial nodes
198198
"""
199199

200-
def __init__(self, problem_params, dtype_u=parallel_mesh, dtype_f=parallel_imex_mesh):
200+
def __init__(self, problem_params, dtype_u=mesh, dtype_f=parallel_imex_mesh):
201201
"""
202202
Initialization routine
203203
@@ -384,7 +384,7 @@ class allencahn_periodic_fullyimplicit(ptype):
384384
dx: distance between two spatial nodes
385385
"""
386386

387-
def __init__(self, problem_params, dtype_u=parallel_mesh, dtype_f=parallel_mesh):
387+
def __init__(self, problem_params, dtype_u=mesh, dtype_f=mesh):
388388
"""
389389
Initialization routine
390390
@@ -549,7 +549,7 @@ class allencahn_periodic_semiimplicit(allencahn_periodic_fullyimplicit):
549549
with driving force, 0-1 formulation (Bayreuth example)
550550
"""
551551

552-
def __init__(self, problem_params, dtype_u=parallel_mesh, dtype_f=parallel_imex_mesh):
552+
def __init__(self, problem_params, dtype_u=mesh, dtype_f=parallel_imex_mesh):
553553
"""
554554
Initialization routine
555555
@@ -620,7 +620,7 @@ class allencahn_periodic_multiimplicit(allencahn_periodic_fullyimplicit):
620620
with driving force, 0-1 formulation (Bayreuth example)
621621
"""
622622

623-
def __init__(self, problem_params, dtype_u=parallel_mesh, dtype_f=parallel_comp2_mesh):
623+
def __init__(self, problem_params, dtype_u=mesh, dtype_f=parallel_comp2_mesh):
624624
"""
625625
Initialization routine
626626

pySDC/implementations/problem_classes/AllenCahn_2D_FD.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from pySDC.core.Errors import ParameterError, ProblemError
77
from pySDC.core.Problem import ptype
8-
from pySDC.implementations.datatype_classes.parallel_mesh import parallel_mesh, parallel_imex_mesh, parallel_comp2_mesh
8+
from pySDC.implementations.datatype_classes.mesh import mesh, parallel_imex_mesh, parallel_comp2_mesh
99

1010

1111
# http://www.personal.psu.edu/qud2/Res/Pre/dz09sisc.pdf
@@ -21,7 +21,7 @@ class allencahn_fullyimplicit(ptype):
2121
dx: distance between two spatial nodes (same for both directions)
2222
"""
2323

24-
def __init__(self, problem_params, dtype_u=parallel_mesh, dtype_f=parallel_mesh):
24+
def __init__(self, problem_params, dtype_u=mesh, dtype_f=mesh):
2525
"""
2626
Initialization routine
2727
@@ -187,7 +187,7 @@ class allencahn_semiimplicit(allencahn_fullyimplicit):
187187
Example implementing the Allen-Cahn equation in 2D with finite differences, SDC standard splitting
188188
"""
189189

190-
def __init__(self, problem_params, dtype_u=parallel_mesh, dtype_f=parallel_imex_mesh):
190+
def __init__(self, problem_params, dtype_u=mesh, dtype_f=parallel_imex_mesh):
191191
"""
192192
Initialization routine
193193
@@ -258,7 +258,7 @@ class allencahn_semiimplicit_v2(allencahn_fullyimplicit):
258258
Example implementing the Allen-Cahn equation in 2D with finite differences, AC splitting
259259
"""
260260

261-
def __init__(self, problem_params, dtype_u=parallel_mesh, dtype_f=parallel_imex_mesh):
261+
def __init__(self, problem_params, dtype_u=mesh, dtype_f=parallel_imex_mesh):
262262
"""
263263
Initialization routine
264264
@@ -352,7 +352,7 @@ class allencahn_multiimplicit(allencahn_fullyimplicit):
352352
Example implementing the Allen-Cahn equation in 2D with finite differences, SDC standard splitting
353353
"""
354354

355-
def __init__(self, problem_params, dtype_u=parallel_mesh, dtype_f=parallel_comp2_mesh):
355+
def __init__(self, problem_params, dtype_u=mesh, dtype_f=parallel_comp2_mesh):
356356
"""
357357
Initialization routine
358358
@@ -479,7 +479,7 @@ class allencahn_multiimplicit_v2(allencahn_fullyimplicit):
479479
Example implementing the Allen-Cahn equation in 2D with finite differences, AC splitting
480480
"""
481481

482-
def __init__(self, problem_params, dtype_u=parallel_mesh, dtype_f=parallel_comp2_mesh):
482+
def __init__(self, problem_params, dtype_u=mesh, dtype_f=parallel_comp2_mesh):
483483
"""
484484
Initialization routine
485485

pySDC/implementations/problem_classes/AllenCahn_2D_FFT.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from pySDC.core.Errors import ParameterError, ProblemError
44
from pySDC.core.Problem import ptype
5-
from pySDC.implementations.datatype_classes.parallel_mesh import parallel_mesh, parallel_imex_mesh
5+
from pySDC.implementations.datatype_classes.mesh import mesh, parallel_imex_mesh
66

77

88
# noinspection PyUnusedLocal
@@ -18,7 +18,7 @@ class allencahn2d_imex(ptype):
1818
irfft_object: planned IFFT for backward transformation
1919
"""
2020

21-
def __init__(self, problem_params, dtype_u=parallel_mesh, dtype_f=parallel_imex_mesh):
21+
def __init__(self, problem_params, dtype_u=mesh, dtype_f=parallel_imex_mesh):
2222
"""
2323
Initialization routine
2424
@@ -147,7 +147,7 @@ class allencahn2d_imex_stab(allencahn2d_imex):
147147
irfft_object: planned IFFT for backward transformation
148148
"""
149149

150-
def __init__(self, problem_params, dtype_u=parallel_mesh, dtype_f=parallel_imex_mesh):
150+
def __init__(self, problem_params, dtype_u=mesh, dtype_f=parallel_imex_mesh):
151151
"""
152152
Initialization routine
153153

0 commit comments

Comments
 (0)