Skip to content

Commit

Permalink
Merge pull request #797 from CEED/jeremy/less-output
Browse files Browse the repository at this point in the history
Refactor tests to reduce use of output
  • Loading branch information
jeremylt committed Aug 2, 2021
2 parents eaf62ff + c3a5a60 commit e508ec0
Show file tree
Hide file tree
Showing 32 changed files with 556 additions and 776 deletions.
5 changes: 2 additions & 3 deletions interface/ceed-basis.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,10 +551,9 @@ int CeedBasisCreateTensorH1Lagrange(Ceed ceed, CeedInt dim, CeedInt num_comp,
c1 = c2;
}
}
// // Pass to CeedBasisCreateTensorH1
// Pass to CeedBasisCreateTensorH1
ierr = CeedBasisCreateTensorH1(ceed, dim, num_comp, P, Q, interp_1d, grad_1d,
q_ref_1d,
q_weight_1d, basis); CeedChk(ierr);
q_ref_1d, q_weight_1d, basis); CeedChk(ierr);
cleanup:
ierr2 = CeedFree(&interp_1d); CeedChk(ierr2);
ierr2 = CeedFree(&grad_1d); CeedChk(ierr2);
Expand Down
29 changes: 29 additions & 0 deletions interface/ceed-fortran.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,15 @@ void fCeedQRFactorization(int *ceed, CeedScalar *mat, CeedScalar *tau, int *m,
*err = CeedQRFactorization(Ceed_dict[*ceed], mat, tau, *m, *n);
}

#define fCeedHouseholderApplyQ \
FORTRAN_NAME(ceedhouseholderapplyq, CEEDHOUSEHOLDERAPPLYQ)
void fCeedHouseholderApplyQ(CeedScalar *A, CeedScalar *Q, CeedScalar *tau,
int *t_mode,
int *m, int *n, int *k, int *row, int *col, int *err) {
*err = CeedHouseholderApplyQ(A, Q, tau, (CeedTransposeMode)*t_mode, *m, *n, *k,
*row, *col);
}

#define fCeedSymmetricSchurDecomposition \
FORTRAN_NAME(ceedsymmetricschurdecomposition, CEEDSYMMETRICSCHURDECOMPOSITION)
void fCeedSymmetricSchurDecomposition(int *ceed, CeedScalar *mat,
Expand Down Expand Up @@ -607,6 +616,26 @@ void fCeedBasisGetInterp1D(int *basis, CeedScalar *interp_1d, int64_t *offset,
*offset = interp1d_ - interp_1d;
}

#define fCeedBasisGetGrad1D \
FORTRAN_NAME(ceedbasisgetgrad1d, CEEDBASISGETGRAD1D)
void fCeedBasisGetGrad1D(int *basis, CeedScalar *grad_1d, int64_t *offset,
int *err) {
const CeedScalar *grad1d_;
CeedBasis basis_ = CeedBasis_dict[*basis];
*err = CeedBasisGetGrad1D(basis_, &grad1d_);
*offset = grad1d_ - grad_1d;
}

#define fCeedBasisGetQRef \
FORTRAN_NAME(ceedbasisgetqref, CEEDBASISGETQREF)
void fCeedBasisGetQRef(int *basis, CeedScalar *q_ref, int64_t *offset,
int *err) {
const CeedScalar *qref_;
CeedBasis basis_ = CeedBasis_dict[*basis];
*err = CeedBasisGetQRef(basis_, &qref_);
*offset = qref_ - q_ref;
}

#define fCeedBasisDestroy FORTRAN_NAME(ceedbasisdestroy,CEEDBASISDESTROY)
void fCeedBasisDestroy(int *basis, int *err) {
if (*basis == FORTRAN_NULL) return;
Expand Down
1 change: 1 addition & 0 deletions python/build_ceed_cffi.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
header = '\n'.join(lines)
header = header.split("static inline CeedInt CeedIntPow", 1)[0]
header += '\nextern int CeedVectorGetState(CeedVector, uint64_t*);'
header += '\nextern int CeedElemRestrictionGetELayout(CeedElemRestriction, CeedInt *layout);'
# Note: cffi cannot handle vargs
header = re.sub("va_list", "const char *", header)
ffibuilder.cdef(header)
Expand Down
23 changes: 23 additions & 0 deletions python/ceed_elemrestriction.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,29 @@ def get_multiplicity(self):
# Return
return mult

# Get ElemRestrition Layout
def get_layout(self):
"""Get the element vector layout of an ElemRestriction.
Returns:
layout: Vector containing layout array, stored as [nodes, components, elements].
The data for node i, component j, element k in the element
vector is given by i*layout[0] + j*layout[1] + k*layout[2]."""

# Create output array
layout = np.zeros(3, dtype="int32")
array_pointer = ffi.cast(
"CeedInt *",
layout.__array_interface__['data'][0])

# libCEED call
err_code = lib.CeedElemRestrictionGetELayout(
self._pointer[0], array_pointer)
self._ceed._check_error(err_code)

# Return
return layout

# ------------------------------------------------------------------------------


Expand Down
33 changes: 0 additions & 33 deletions python/tests/output/test_202.out

This file was deleted.

23 changes: 0 additions & 23 deletions python/tests/output/test_208.out

This file was deleted.

15 changes: 0 additions & 15 deletions python/tests/output/test_301.out

This file was deleted.

22 changes: 0 additions & 22 deletions python/tests/output/test_304.out

This file was deleted.

Loading

0 comments on commit e508ec0

Please sign in to comment.