ceed_basis.py (572ff09c85e1de07bdd8bed4adbe59486604f1e4) ceed_basis.py (d99fa3c5cd91a1690aedf0679cbf290d44fec74c)
1# Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at
2# the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
3# reserved. See files LICENSE and NOTICE for details.
4#
5# This file is part of CEED, a collection of benchmarks, miniapps, software
6# libraries and APIs for efficient high-order finite element and spectral
7# element discretizations for exascale applications. For more information and
8# source code availability see http://github.com/ceed.

--- 324 unchanged lines hidden (view full) ---

333
334 # libCEED call
335 err_code = lib.CeedBasisCreateTensorH1(self._ceed._pointer[0], dim, ncomp,
336 P1d, Q1d, interp1d_pointer,
337 grad1d_pointer, qref1d_pointer,
338 qweight1d_pointer, self._pointer)
339 self._ceed._check_error(err_code)
340
1# Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at
2# the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
3# reserved. See files LICENSE and NOTICE for details.
4#
5# This file is part of CEED, a collection of benchmarks, miniapps, software
6# libraries and APIs for efficient high-order finite element and spectral
7# element discretizations for exascale applications. For more information and
8# source code availability see http://github.com/ceed.

--- 324 unchanged lines hidden (view full) ---

333
334 # libCEED call
335 err_code = lib.CeedBasisCreateTensorH1(self._ceed._pointer[0], dim, ncomp,
336 P1d, Q1d, interp1d_pointer,
337 grad1d_pointer, qref1d_pointer,
338 qweight1d_pointer, self._pointer)
339 self._ceed._check_error(err_code)
340
341 #
342 def get_interp1d(self):
343 """Return 1D interpolation matrix of a tensor product Basis.
344
345 Returns:
346 *array: Numpy array"""
347
348 # Compute the length of the array
349 nnodes_pointer = ffi.new("CeedInt *")
350 lib.CeedBasisGetNumNodes1D(self._pointer[0], nnodes_pointer)
351 nqpts_pointer = ffi.new("CeedInt *")
352 lib.CeedBasisGetNumQuadraturePoints1D(self._pointer[0], nqpts_pointer)
353 length = nnodes_pointer[0] * nqpts_pointer[0]
354
355 # Setup the pointer's pointer
356 array_pointer = ffi.new("CeedScalar **")
357
358 # libCEED call
359 lib.CeedBasisGetInterp1D(self._pointer[0], array_pointer)
360
361 # Return array created from buffer
362 # Create buffer object from returned pointer
363 buff = ffi.buffer(
364 array_pointer[0],
365 ffi.sizeof("CeedScalar") *
366 length)
367 # return read only Numpy array
368 ret = np.frombuffer(buff, dtype="float64")
369 ret.flags['WRITEABLE'] = False
370 return ret
371
372
341# ------------------------------------------------------------------------------
342
343
373# ------------------------------------------------------------------------------
374
375
344class BasisTensorH1Lagrange(Basis):
376class BasisTensorH1Lagrange(BasisTensorH1):
345 """Ceed Tensor H1 Lagrange Basis: finite element tensor-product Lagrange basis
346 objects for H^1 discretizations."""
347
348 # Constructor
349 def __init__(self, ceed, dim, ncomp, P, Q, qmode):
350
351 # Setup arguments
352 self._pointer = ffi.new("CeedBasis *")

--- 84 unchanged lines hidden ---
377 """Ceed Tensor H1 Lagrange Basis: finite element tensor-product Lagrange basis
378 objects for H^1 discretizations."""
379
380 # Constructor
381 def __init__(self, ceed, dim, ncomp, P, Q, qmode):
382
383 # Setup arguments
384 self._pointer = ffi.new("CeedBasis *")

--- 84 unchanged lines hidden ---