9 #include "GmshConfig.h"
16 #if defined(HAVE_LIBCGNS)
18 int cgnsError(
const char *file,
const int line,
const int fileIndex)
25 if(cg_close(fileIndex)) {
Msg::Error(
"Unable to close CGNS file"); }
30 void printProgress(
const char *cstr, std::size_t i, std::size_t num)
33 if(i % 100 == 1) {
Msg::Info(
"%s %d/%d", cstr, i, num); }
40 #if defined(HAVE_LIBCGNS_CPEX0045)
42 int evalMonomialBasis(
int mshType,
const std::vector<double> &u,
43 const std::vector<double> &v,
53 Msg::Error(
"Serendipity elements are not supported in CPEX0045 mode in "
60 if(parentType ==
TYPE_PNT) { val(0, 0) = 1.; }
62 for(
int iPt = 0; iPt < nbPt; iPt++) {
64 for(
int i = 1; i <= order; i++) val(i, iPt) = u[iPt] * val(i - 1, iPt);
68 for(
int iPt = 0; iPt < nbPt; iPt++) {
70 for(
int i = 0; i <= order; i++) {
71 for(
int j = 0; j <= i; j++) {
72 val(iSF, iPt) = std::pow(u[iPt], i - j) * std::pow(v[iPt], j);
79 for(
int iPt = 0; iPt < nbPt; iPt++) {
81 for(
int i = 0; i <= order; i++) {
82 for(
int j = 0; j <= order; j++) {
83 val(iSF, iPt) = std::pow(u[iPt], i) * std::pow(v[iPt], j);
90 for(
int iPt = 0; iPt < nbPt; iPt++) {
92 for(
int i = 0; i <= order; i++) {
93 for(
int j = 0; j <= i; j++) {
94 for(
int k = 0; k <= i - j; k++) {
95 val(iSF, iPt) = std::pow(u[iPt], i - j - k) * std::pow(v[iPt], k) *
106 for(
int iPt = 0; iPt < nbPt; iPt++) {
108 const double ww = 0.5 * (w[iPt] + 1.);
109 bb.f(u[iPt], v[iPt], ww, oneVal);
110 for(
int iSF = 0; iSF < nbSF; iSF++) val(iSF, iPt) = oneVal[iSF];
114 for(
int iPt = 0; iPt < nbPt; iPt++) {
116 for(
int i = 0; i <= order; i++) {
117 for(
int j = 0; j <= i; j++) {
118 for(
int k = 0; k <= order; k++) {
119 val(iSF, iPt) = std::pow(u[iPt], i - j) * std::pow(v[iPt], j) *
128 for(
int iPt = 0; iPt < nbPt; iPt++) {
130 for(
int i = 0; i <= order; i++) {
131 for(
int j = 0; j <= order; j++) {
132 for(
int k = 0; k <= order; k++) {
134 std::pow(u[iPt], i) * std::pow(v[iPt], j) * std::pow(w[iPt], k);
142 Msg::Error(
"Element of parent type %i is not supported in CPEX0045 mode "
151 #endif // HAVE_LIBCGNS_CPEX0045
154 void StructuredIndexing<DIM>::entFromRange(
const cgsize_t *range,
155 const cgsize_t *nbEntIJK,
156 std::vector<cgsize_t> &elt)
158 elt.resize(nbEntInRange(range));
161 const cgsize_t ijkStart[3] = {range[0] - 1, range[1] - 1,
162 (DIM == 3) ? range[2] - 1 : 0};
163 const cgsize_t ijkEnd[3] = {range[DIM] - 1, range[DIM + 1] - 1,
164 (DIM == 3) ? range[5] - 1 : 0};
165 const cgsize_t ijkInc[3] = {(range[DIM] >= range[0]) ? 1 : -1,
166 (range[DIM + 1] >= range[1]) ? 1 : -1,
167 ((DIM < 3) || (range[5] >= range[2])) ? 1 : -1};
170 std::size_t iElt = 0;
171 cgsize_t ijk[3], &i = ijk[0], &j = ijk[1], &k = ijk[2];
172 for(k = ijkStart[2]; k <= ijkEnd[2]; k += ijkInc[2]) {
173 for(j = ijkStart[1]; j <= ijkEnd[1]; j += ijkInc[1]) {
174 for(i = ijkStart[0]; i <= ijkEnd[0]; i += ijkInc[0]) {
175 elt[iElt] = ijk2Ind<DIM>(ijk, nbEntIJK);
183 void StructuredIndexing<DIM>::entFromList(
const std::vector<cgsize_t> &list,
184 const cgsize_t *nbEntIJK,
185 std::vector<cgsize_t> &elt)
187 std::size_t nb = list.size() / DIM;
190 for(std::size_t i = 0; i < nb; i++) {
192 for(
int d = 0; d < DIM; d++) ijk[d] = list[i * DIM + d] - 1;
193 elt[i] = ijk2Ind<DIM>(ijk, nbEntIJK);
199 template struct StructuredIndexing<2>;
200 template struct StructuredIndexing<3>;
202 #endif // HAVE_LIBCGNS