ceed-impl.h (44b9b2cd6e0629e3bd0dac35b45aaf8447e601e0) ceed-impl.h (0a7eccc5d148a2d9de00778798917c140a0c5a75)
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.

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

47#define CeedChk(ierr) do { if (ierr) return ierr; } while (0)
48/* Note that CeedMalloc and CeedCalloc will, generally, return pointers with
49 different memory alignments: CeedMalloc returns pointers aligned at
50 CEED_ALIGN bytes, while CeedCalloc uses the alignment of calloc. */
51#define CeedMalloc(n, p) CeedMallocArray((n), sizeof(**(p)), p)
52#define CeedCalloc(n, p) CeedCallocArray((n), sizeof(**(p)), p)
53#define CeedRealloc(n, p) CeedReallocArray((n), sizeof(**(p)), p)
54
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.

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

47#define CeedChk(ierr) do { if (ierr) return ierr; } while (0)
48/* Note that CeedMalloc and CeedCalloc will, generally, return pointers with
49 different memory alignments: CeedMalloc returns pointers aligned at
50 CEED_ALIGN bytes, while CeedCalloc uses the alignment of calloc. */
51#define CeedMalloc(n, p) CeedMallocArray((n), sizeof(**(p)), p)
52#define CeedCalloc(n, p) CeedCallocArray((n), sizeof(**(p)), p)
53#define CeedRealloc(n, p) CeedReallocArray((n), sizeof(**(p)), p)
54
55void CeedDebug(const char *,...);
55// CEED_DEBUG_COLOR default value, forward CeedDebug* declarations & dbg macros
56#ifndef CEED_DEBUG_COLOR
57#define CEED_DEBUG_COLOR 0
58#endif
59extern CeedInt ceed_debug;
60CEED_INTERN void CeedDebugImpl(const char*,...);
61CEED_INTERN void CeedDebugImpl256(const unsigned char,const char*,...);
62#define CeedDebug(format, ...) CeedDebugImpl (format, ## __VA_ARGS__)
63#define CeedDebug256(color, ...) CeedDebugImpl256(color, ## __VA_ARGS__)
64// Generic selection, but since C11; if not acceptable, uncomment dbg CeedDebug
65#define cdbg(c,...) _Generic((c), \
66 unsigned char: CeedDebugImpl256, \
67 default: CeedDebugImpl)(c,## __VA_ARGS__)
68#define dbg(...) cdbg((unsigned char)CEED_DEBUG_COLOR, ## __VA_ARGS__)
69//#define dbg CeedDebug
56
57struct CeedVector_private {
58 Ceed ceed;
59 int (*SetArray)(CeedVector, CeedMemType, CeedCopyMode, CeedScalar *);
60 int (*GetArray)(CeedVector, CeedMemType, CeedScalar **);
61 int (*GetArrayRead)(CeedVector, CeedMemType, const CeedScalar **);
62 int (*RestoreArray)(CeedVector, CeedScalar **);
63 int (*RestoreArrayRead)(CeedVector, const CeedScalar **);

--- 69 unchanged lines hidden ---
70
71struct CeedVector_private {
72 Ceed ceed;
73 int (*SetArray)(CeedVector, CeedMemType, CeedCopyMode, CeedScalar *);
74 int (*GetArray)(CeedVector, CeedMemType, CeedScalar **);
75 int (*GetArrayRead)(CeedVector, CeedMemType, const CeedScalar **);
76 int (*RestoreArray)(CeedVector, CeedScalar **);
77 int (*RestoreArrayRead)(CeedVector, const CeedScalar **);

--- 69 unchanged lines hidden ---