diff --git a/Graphics/Post.cpp b/Graphics/Post.cpp index 89c70a9b7ea2213ee9c2c60cdcbfaa7a5965a525..d16e3b8144f2ffcd719d3b0e58b887110e953daa 100644 --- a/Graphics/Post.cpp +++ b/Graphics/Post.cpp @@ -1,4 +1,4 @@ -// $Id: Post.cpp,v 1.152 2008-02-24 14:55:36 geuzaine Exp $ +// $Id: Post.cpp,v 1.153 2008-02-24 16:18:19 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -884,22 +884,6 @@ void addTensorElement(PView *p, int numNodes, int numEdges, double xyz[NMAX][3], } } -bool skipElement(PView *p, int numEdges) -{ - PViewOptions *opt = p->getOptions(); - switch(numEdges){ - case 0: return !opt->DrawPoints; - case 1: return !opt->DrawLines; - case 3: return !opt->DrawTriangles; - case 4: return !opt->DrawQuadrangles; - case 6: return !opt->DrawTetrahedra; - case 12: return !opt->DrawHexahedra; - case 9: return !opt->DrawPrisms; - case 8: return !opt->DrawPyramids; - default: return true; - } -} - void addElementsInArrays(PView *p, bool preprocessNormalsOnly) { PViewData *data = p->getData(); @@ -909,9 +893,11 @@ void addElementsInArrays(PView *p, bool preprocessNormalsOnly) double xyz[NMAX][3], val[NMAX][9]; for(int ent = 0; ent < data->getNumEntities(); ent++){ + if(data->skipEntity(ent)) continue; for(int i = 0; i < data->getNumElements(ent); i++){ + if(data->skipElement(ent, i)) continue; int numEdges = data->getNumEdges(ent, i); - if(skipElement(p, numEdges)) continue; + if(opt->skipElement(numEdges)) continue; int numComp = data->getNumComponents(ent, i); int numNodes = data->getNumNodes(ent, i); for(int j = 0; j < numNodes; j++){ @@ -1146,9 +1132,11 @@ void drawGlyphs(PView *p) double xyz[NMAX][3], val[NMAX][9]; for(int ent = 0; ent < data->getNumEntities(); ent++){ + if(data->skipEntity(ent)) continue; for(int i = 0; i < data->getNumElements(ent); i++){ + if(data->skipElement(ent, i)) continue; int numEdges = data->getNumEdges(ent, i); - if(skipElement(p, numEdges)) continue; + if(opt->skipElement(numEdges)) continue; int dim = data->getDimension(ent, i); int numComp = data->getNumComponents(ent, i); int numNodes = data->getNumNodes(ent, i); diff --git a/Post/PViewData.h b/Post/PViewData.h index aff85a8ba659d04590d317f2686e7612222d3d86..c46119c8fc44b751116961a2d9d0b9d64a4215ef 100644 --- a/Post/PViewData.h +++ b/Post/PViewData.h @@ -100,6 +100,8 @@ class PViewData { virtual bool combineTime(nameData &nd){ return false; } virtual bool combineSpace(nameData &nd){ return false; } virtual bool isAdaptive(){ return false; } + virtual bool skipEntity(int ent){ return false; } + virtual bool skipElement(int ent, int ele){ return false; } // I/O routines virtual bool writePOS(std::string name, bool binary=false, bool parsed=true, diff --git a/Post/PViewDataGModel.cpp b/Post/PViewDataGModel.cpp index 9e4952d66eb49e6b32c576adcec41d3722da846c..2eaca1f66f29e478f83fe81d00e9f4d86b2778e7 100644 --- a/Post/PViewDataGModel.cpp +++ b/Post/PViewDataGModel.cpp @@ -1,4 +1,4 @@ -// $Id: PViewDataGModel.cpp,v 1.14 2008-02-24 14:55:36 geuzaine Exp $ +// $Id: PViewDataGModel.cpp,v 1.15 2008-02-24 16:18:19 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -25,6 +25,49 @@ #include "PViewDataGModel.h" #include "Message.h" +PViewDataGModel::PViewDataGModel(GModel *model) : _model(model) +{ + /* + store linear vector of GEntity* (index in that vector used for + all element access later) + + create a vector (one entry per time step) of + + class data{ + // nodes components + std::vector< std::vector<double > > + } + + When reading a .msh file: + + * get node number in file + * get vertex pointer from _model->_vertexCache + * if MVertex + has no dataIndex, increment it (need global value stored in GModel) + it has one, do nothing + * fill the dataIndex entry in data{} + + + + .msh file format: + + $NodeData + name precision-single-double step time-value + type node-or-ele-id num-comp val (num-comp times) + type node-or-ele-id num-comp val (num-comp times) + ... + $EndNodeData + + number of time steps stored should be an option. should be able + to dynamically load/overwrite time step when reading new one + */ +} + +PViewDataGModel::~PViewDataGModel() +{ + +} + double PViewDataGModel::getTime(int step) { return 0; @@ -82,6 +125,16 @@ int PViewDataGModel::getNumEdges(int ent, int ele) return 0; } +bool PViewDataGModel::skipEntity(int ent) +{ + return false; +} + +bool PViewDataGModel::skipElement(int ent, int ele) +{ + return false; +} + bool PViewDataGModel::readMSH(FILE *fp) { Msg(INFO, "Filling PViewDataGModel..."); diff --git a/Post/PViewDataGModel.h b/Post/PViewDataGModel.h index ba3139d09c9db2d16a050fe5e942adae6c3a8138..215f925fb759724854510d0ff9fd61231e32fc56 100644 --- a/Post/PViewDataGModel.h +++ b/Post/PViewDataGModel.h @@ -31,8 +31,8 @@ class PViewDataGModel : public PViewData { GModel *_model; PViewDataList *_cloneToList(); // create old-style data from this public: - PViewDataGModel(GModel *model) : _model(model) {} - ~PViewDataGModel(){} + PViewDataGModel(GModel *model); + ~PViewDataGModel(); int getNumTimeSteps(){ return 1; } double getTime(int step); double getMin(int step=-1); @@ -46,6 +46,8 @@ class PViewDataGModel : public PViewData { int getNumComponents(int ent, int ele); void getValue(int ent, int ele, int node, int comp, int step, double &val); int getNumEdges(int ent, int ele); + bool skipEntity(int ent); + bool skipElement(int ent, int ele); // I/O routines bool readMSH(FILE *fp); diff --git a/Post/PViewOptions.cpp b/Post/PViewOptions.cpp index 8b09d1d8e66a3464e591d5b8e4ae6b298d67a737..aaef4c40b1f44aa87a794af88b73d8e2282e33cc 100644 --- a/Post/PViewOptions.cpp +++ b/Post/PViewOptions.cpp @@ -1,4 +1,4 @@ -// $Id: PViewOptions.cpp,v 1.18 2008-02-17 08:48:08 geuzaine Exp $ +// $Id: PViewOptions.cpp,v 1.19 2008-02-24 16:18:19 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -146,3 +146,17 @@ void PViewOptions::createGeneralRaise() #endif } +bool PViewOptions::skipElement(int numEdges) +{ + switch(numEdges){ + case 0: return !DrawPoints; + case 1: return !DrawLines; + case 3: return !DrawTriangles; + case 4: return !DrawQuadrangles; + case 6: return !DrawTetrahedra; + case 12: return !DrawHexahedra; + case 9: return !DrawPrisms; + case 8: return !DrawPyramids; + default: return true; + } +} diff --git a/Post/PViewOptions.h b/Post/PViewOptions.h index f37baa2cdc743a32016e56c813b21f0477e08873..865bb3d55938f2b309f688282e41c8bc9eeaa89b 100644 --- a/Post/PViewOptions.h +++ b/Post/PViewOptions.h @@ -116,6 +116,7 @@ class PViewOptions { bool forceLinear=false); unsigned int getColor(int i, int nb); unsigned int getColor(double val, double min, double max, bool forceLinear=false); + bool skipElement(int numEdges); }; #endif