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

first implementation of importLists for mesh-based views

parent bdf3ebb1
No related branches found
No related tags found
No related merge requests found
......@@ -129,7 +129,7 @@ set(GMSH_API
Solver/linearSystemFull.h Solver/elasticitySolver.h Solver/sparsityPattern.h
Solver/groupOfElements.h Solver/linearSystemPETSc.h Solver/linearSystemMUMPS.h
Post/PView.h Post/PViewData.h Plugin/PluginManager.h Post/OctreePost.h
Post/PViewDataGModel.h Post/PViewOptions.h Post/ColorTable.h
Post/PViewDataList.h Post/PViewDataGModel.h Post/PViewOptions.h Post/ColorTable.h
Numeric/nodalBasis.h
Graphics/drawContext.h
contrib/kbipack/gmp_normal_form.h contrib/kbipack/gmp_matrix.h
......
......@@ -6,6 +6,7 @@
#include "GmshConfig.h"
#include "GmshMessage.h"
#include "GModel.h"
#include "PView.h"
#include "GmshDefines.h"
#include "StringUtils.h"
#include "Context.h"
......@@ -634,3 +635,4 @@ void CreateOutputFile(const std::string &fileName, int format,
if(redraw) drawContext::global()->draw();
#endif
}
......@@ -1060,7 +1060,7 @@ static int createColumnsBetweenFaces(GRegion *gr,
return joints.size();
}
static int createColumnsOnSymmetryPlane(MVertex *myV,
static void createColumnsOnSymmetryPlane(MVertex *myV,
BoundaryLayerColumns *_columns,
std::set<GFace*> &_allGFaces,
std::list<GFace*> &faces,
......
......@@ -157,33 +157,45 @@ class BoundaryLayerField : public Field {
~BoundaryLayerField() {removeAttractors();}
virtual double operator() (double x, double y, double z, GEntity *ge=0);
virtual void operator() (double x, double y, double z, SMetric3 &metr, GEntity *ge=0);
bool isFaceBL (int iF) const {return std::find(faces_id.begin(),faces_id.end(),iF) != faces_id.end();}
bool isEdgeBL (int iE) const {return std::find(edges_id.begin(),edges_id.end(),iE) != edges_id.end();}
bool isEdgeBLSaved (int iE) const {return std::find(edges_id_saved.begin(),edges_id_saved.end(),iE) != edges_id_saved.end();}
bool isFan (int iE) const {return std::find(fans_id.begin(),fans_id.end(),iE) != fans_id.end();}
bool isFanNode (int iV) const {return std::find(fan_nodes_id.begin(),fan_nodes_id.end(),iV) != fan_nodes_id.end();}
bool isVertexBL (int iV) const {return std::find(nodes_id.begin(),nodes_id.end(),iV) != nodes_id.end();}
bool isFaceBL (int iF) const
{
return std::find(faces_id.begin(),faces_id.end(),iF) != faces_id.end();
}
bool isEdgeBL (int iE) const
{
return std::find(edges_id.begin(),edges_id.end(),iE) != edges_id.end();
}
bool isEdgeBLSaved (int iE) const
{
return std::find(edges_id_saved.begin(),edges_id_saved.end(),iE)
!= edges_id_saved.end();
}
bool isFan (int iE) const
{
return std::find(fans_id.begin(),fans_id.end(),iE) != fans_id.end();
}
bool isFanNode (int iV) const
{
return std::find(fan_nodes_id.begin(),fan_nodes_id.end(),iV) != fan_nodes_id.end();
}
bool isVertexBL (int iV) const
{
return std::find(nodes_id.begin(),nodes_id.end(),iV) != nodes_id.end();
}
void computeFor1dMesh(double x, double y, double z, SMetric3 &metr);
void setupFor2d(int iF);
void setupFor3d();
void removeAttractors();
};
#else
class BoundaryLayerField : public Field {
public:
double hwall_n,hwall_t,ratio,hfar,thickness;//,fan_angle;
double current_distance, tgt_aniso_ratio;
SPoint3 _closest_point;
int iRecombine, iIntersect;
//AttractorField *current_closest;
virtual bool isotropic() const { return false; }
virtual const char *getName(){ return ""; }
virtual std::string getDescription(){ return ""; }
BoundaryLayerField() : hwall_n(0.), hwall_t(0.), ratio(0.),
hfar(0.), thickness(0.), fan_angle(0.),
current_distance(0.), tgt_aniso_ratio(0.),
_closest_point(0.,0.,0.), iRecombine(0), iIntersect(0)
//current_closest(NULL)
BoundaryLayerField()
{
Msg::Error("You must compile with ANN to use BoundaryLayerField");
}
......@@ -194,11 +206,12 @@ class BoundaryLayerField : public Field {
bool isEdgeBL (int iE) const {return false;}
bool isFan (int iE) const {return false;}
bool isVertexBL (int iV) const {return false;}
void computeFor1dMesh(double x, double y, double z, SMetric3 &metr){return;}
void setupFor2d(int iF){return;}
void setupFor3d(){return;}
void removeAttractors(){return;}
void computeFor1dMesh(double x, double y, double z, SMetric3 &metr){}
void setupFor2d(int iF){}
void setupFor3d(){}
void removeAttractors(){}
};
#endif
class FieldOptionString : public FieldOption
......@@ -218,7 +231,6 @@ class FieldOptionString : public FieldOption
}
};
class FieldOptionDouble : public FieldOption
{
public:
......@@ -311,7 +323,8 @@ class FieldCallbackGeneric : public FieldCallback {
{
(_field->*_callback)();
}
FieldCallbackGeneric( t *field, void (t::*callback)(), const std::string description) : FieldCallback(description)
FieldCallbackGeneric( t *field, void (t::*callback)(), const std::string description)
: FieldCallback(description)
{
_field = field;
_callback = callback;
......
......@@ -255,6 +255,7 @@ class PViewDataGModel : public PViewData {
bool forceNodeData=false);
bool readMED(const std::string &fileName, int fileIndex);
bool writeMED(const std::string &fileName);
void importLists(int N[24], std::vector<double> *V[24]);
};
#endif
......@@ -298,6 +298,65 @@ bool PViewDataGModel::writeMSH(const std::string &fileName, double version, bool
return true;
}
void PViewDataGModel::importLists(int N[24], std::vector<double> *V[24])
{
for(int idxtype = 0; idxtype < 24; idxtype++){
int nbe = N[idxtype];
if(!nbe) continue;
std::vector<double> *list = V[idxtype];
int nc = 0, nn = 0;
switch(idxtype){
case 0 : nc = 1; nn = 1; break; // SP
case 1 : nc = 3; nn = 1; break; // VP
case 2 : nc = 9; nn = 1; break; // TP
case 3 : nc = 1; nn = 2; break; // SL
case 4 : nc = 3; nn = 2; break; // VL
case 5 : nc = 9; nn = 2; break; // TL
case 6 : nc = 1; nn = 3; break; // ST
case 7 : nc = 3; nn = 3; break; // VT
case 8 : nc = 9; nn = 3; break; // TT
case 9 : nc = 1; nn = 4; break; // SQ
case 10: nc = 3; nn = 4; break; // VQ
case 11: nc = 9; nn = 4; break; // TQ
case 12: nc = 1; nn = 4; break; // SS
case 13: nc = 3; nn = 4; break; // VS
case 14: nc = 9; nn = 4; break; // TS
case 15: nc = 1; nn = 8; break; // SH
case 16: nc = 3; nn = 8; break; // VH
case 17: nc = 9; nn = 8; break; // TH
case 18: nc = 1; nn = 6; break; // SI
case 19: nc = 3; nn = 6; break; // VI
case 20: nc = 9; nn = 6; break; // TI
case 21: nc = 1; nn = 5; break; // SY
case 22: nc = 3; nn = 5; break; // VY
case 23: nc = 9; nn = 5; break; // TY
}
int stride = list->size() / nbe;
int numSteps = (stride - 1) / nc / nn;
for(int step = 0; step < numSteps; step++){
printf("creating step %d\n", step);
_steps.push_back(new stepData<double>(GModel::current(), nc));
_steps[step]->fillEntities();
_steps[step]->computeBoundingBox();
_steps[step]->setTime(step);
_steps[step]->resizeData(nbe);
for(unsigned int j = 0; j < list->size(); j += stride){
double *tmp = &(*list)[j];
int num = (int)tmp[0];
printf("importing ele %d\n", num);
double *d = _steps[step]->getData(num, true, nn);
for(int k = 0; k < nc * nn; k++){
d[k] = tmp[1 + nc * nn * step + k];
printf(" val[%d]=%g\n", k, d[k]);
}
}
}
}
finalize();
}
#if defined(HAVE_MED)
extern "C" {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment