Skip to content
Snippets Groups Projects
Commit 05d79704 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

don't crash of we try to display serendipity pyramids

parent 14940753
No related branches found
No related tags found
No related merge requests found
...@@ -355,7 +355,8 @@ class initMeshGRegion { ...@@ -355,7 +355,8 @@ class initMeshGRegion {
for(unsigned int i = 0; i < r->polyhedra.size(); i++) for(unsigned int i = 0; i < r->polyhedra.size(); i++)
numLP += 2 * r->polyhedra[i]->getNumEdges(); numLP += 2 * r->polyhedra[i]->getNumEdges();
num += (12 * r->tetrahedra.size() + 24 * r->hexahedra.size() + num += (12 * r->tetrahedra.size() + 24 * r->hexahedra.size() +
18 * r->prisms.size() + 16 * r->pyramids.size() + 10 * r->trihedra.size() + numLP) / 4; 18 * r->prisms.size() + 16 * r->pyramids.size() +
10 * r->trihedra.size() + numLP) / 4;
num = _estimateIfClipped(num); num = _estimateIfClipped(num);
if(CTX::instance()->mesh.explode != 1.) num *= 4; if(CTX::instance()->mesh.explode != 1.) num *= 4;
if(_curved) num *= 2; if(_curved) num *= 2;
...@@ -370,7 +371,8 @@ class initMeshGRegion { ...@@ -370,7 +371,8 @@ class initMeshGRegion {
for(unsigned int i = 0; i < r->polyhedra.size(); i++) for(unsigned int i = 0; i < r->polyhedra.size(); i++)
numFP += r->polyhedra[i]->getNumFaces(); numFP += r->polyhedra[i]->getNumFaces();
num += (4 * r->tetrahedra.size() + 12 * r->hexahedra.size() + num += (4 * r->tetrahedra.size() + 12 * r->hexahedra.size() +
8 * r->prisms.size() + 6 * r->pyramids.size() + 4 * r->trihedra.size() + numFP) / 2; 8 * r->prisms.size() + 6 * r->pyramids.size() +
4 * r->trihedra.size() + numFP) / 2;
num = _estimateIfClipped(num); num = _estimateIfClipped(num);
if(CTX::instance()->mesh.explode != 1.) num *= 2; if(CTX::instance()->mesh.explode != 1.) num *= 2;
if(_curved) num *= 4; if(_curved) num *= 4;
......
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
#include "pyramidalBasis.h" #include "pyramidalBasis.h"
#include "pointsGenerators.h" #include "pointsGenerators.h"
pyramidalBasis::pyramidalBasis(int tag) : nodalBasis(tag) pyramidalBasis::pyramidalBasis(int tag) : nodalBasis(tag), bergot(0)
{ {
if (serendip) { if (serendip) {
Msg::Error("Serendipity Pyramid not implemented"); Msg::Warning("Serendipity pyramid not implemented yet");
return; return;
} }
...@@ -56,21 +56,16 @@ pyramidalBasis::pyramidalBasis(int tag) : nodalBasis(tag) ...@@ -56,21 +56,16 @@ pyramidalBasis::pyramidalBasis(int tag) : nodalBasis(tag)
delete[] fval; delete[] fval;
} }
pyramidalBasis::~pyramidalBasis() pyramidalBasis::~pyramidalBasis()
{ {
delete bergot; if(bergot) delete bergot;
} }
int pyramidalBasis::getNumShapeFunctions() const { return points.size1(); } int pyramidalBasis::getNumShapeFunctions() const { return points.size1(); }
void pyramidalBasis::f(double u, double v, double w, double *val) const void pyramidalBasis::f(double u, double v, double w, double *val) const
{ {
if(!bergot) return;
const int N = bergot->size(); const int N = bergot->size();
...@@ -83,13 +78,11 @@ void pyramidalBasis::f(double u, double v, double w, double *val) const ...@@ -83,13 +78,11 @@ void pyramidalBasis::f(double u, double v, double w, double *val) const
} }
delete[] fval; delete[] fval;
} }
void pyramidalBasis::f(const fullMatrix<double> &coord, fullMatrix<double> &sf) const void pyramidalBasis::f(const fullMatrix<double> &coord, fullMatrix<double> &sf) const
{ {
if(!bergot) return;
const int N = bergot->size(), NPts = coord.size1(); const int N = bergot->size(), NPts = coord.size1();
...@@ -105,13 +98,11 @@ void pyramidalBasis::f(const fullMatrix<double> &coord, fullMatrix<double> &sf) ...@@ -105,13 +98,11 @@ void pyramidalBasis::f(const fullMatrix<double> &coord, fullMatrix<double> &sf)
} }
delete[] fval; delete[] fval;
} }
void pyramidalBasis::df(double u, double v, double w, double grads[][3]) const void pyramidalBasis::df(double u, double v, double w, double grads[][3]) const
{ {
if(!bergot) return;
const int N = bergot->size(); const int N = bergot->size();
...@@ -128,13 +119,11 @@ void pyramidalBasis::df(double u, double v, double w, double grads[][3]) const ...@@ -128,13 +119,11 @@ void pyramidalBasis::df(double u, double v, double w, double grads[][3]) const
} }
delete[] dfval; delete[] dfval;
} }
void pyramidalBasis::df(const fullMatrix<double> &coord, fullMatrix<double> &dfm) const void pyramidalBasis::df(const fullMatrix<double> &coord, fullMatrix<double> &dfm) const
{ {
if(!bergot) return;
const int N = bergot->size(), NPts = coord.size1(); const int N = bergot->size(), NPts = coord.size1();
...@@ -151,5 +140,4 @@ void pyramidalBasis::df(const fullMatrix<double> &coord, fullMatrix<double> &dfm ...@@ -151,5 +140,4 @@ void pyramidalBasis::df(const fullMatrix<double> &coord, fullMatrix<double> &dfm
} }
delete[] dfv; delete[] dfv;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment