diff --git a/Plugin/Curl.cpp b/Plugin/Curl.cpp index 7aa7f7a77f69d97c0a8b9c0a97fb051b0029da48..da99246d00843e605fcf60052bbe48efa5c7eafa 100644 --- a/Plugin/Curl.cpp +++ b/Plugin/Curl.cpp @@ -1,4 +1,4 @@ -// $Id: Curl.cpp,v 1.10 2008-05-04 08:31:23 geuzaine Exp $ +// $Id: Curl.cpp,v 1.11 2008-05-12 20:24:05 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -20,7 +20,7 @@ // Please report all bugs and problems to <gmsh@geuz.org>. #include "Curl.h" -#include "ShapeFunctions.h" +#include "shapeFunctions.h" StringXNumber CurlOptions_Number[] = { {GMSH_FULLRC, "iView", NULL, -1.} diff --git a/Plugin/Divergence.cpp b/Plugin/Divergence.cpp index fe357b1ca7cfe49f4d7e6c4a14900640143fd0d9..969ee9896ea04ccc2785b152dbd9fccc70114953 100644 --- a/Plugin/Divergence.cpp +++ b/Plugin/Divergence.cpp @@ -1,4 +1,4 @@ -// $Id: Divergence.cpp,v 1.10 2008-05-04 08:31:23 geuzaine Exp $ +// $Id: Divergence.cpp,v 1.11 2008-05-12 20:24:05 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -20,7 +20,7 @@ // Please report all bugs and problems to <gmsh@geuz.org>. #include "Divergence.h" -#include "ShapeFunctions.h" +#include "shapeFunctions.h" StringXNumber DivergenceOptions_Number[] = { {GMSH_FULLRC, "iView", NULL, -1.} diff --git a/Plugin/Gradient.cpp b/Plugin/Gradient.cpp index 0014f5be5fc690dd7f87ca66895bcb87854fec13..0c14556f3b28e319280b790991f311be0655edc3 100644 --- a/Plugin/Gradient.cpp +++ b/Plugin/Gradient.cpp @@ -1,4 +1,4 @@ -// $Id: Gradient.cpp,v 1.15 2008-05-04 08:31:23 geuzaine Exp $ +// $Id: Gradient.cpp,v 1.16 2008-05-12 20:24:05 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -20,7 +20,7 @@ // Please report all bugs and problems to <gmsh@geuz.org>. #include "Gradient.h" -#include "ShapeFunctions.h" +#include "shapeFunctions.h" StringXNumber GradientOptions_Number[] = { {GMSH_FULLRC, "iView", NULL, -1.} diff --git a/Plugin/Integrate.cpp b/Plugin/Integrate.cpp index 29105393960aee7b8a3ba7db1f0628bcff4e899c..c2724457d3fec72718db5c7c26948e7e0e789f58 100644 --- a/Plugin/Integrate.cpp +++ b/Plugin/Integrate.cpp @@ -1,4 +1,4 @@ -// $Id: Integrate.cpp,v 1.26 2008-05-04 08:31:23 geuzaine Exp $ +// $Id: Integrate.cpp,v 1.27 2008-05-12 20:24:05 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -20,7 +20,7 @@ // Please report all bugs and problems to <gmsh@geuz.org>. #include "Integrate.h" -#include "ShapeFunctions.h" +#include "shapeFunctions.h" #include "PViewOptions.h" StringXNumber IntegrateOptions_Number[] = { diff --git a/Plugin/Lambda2.cpp b/Plugin/Lambda2.cpp index c4c9f8373633b79c5a4c355ce12a095bc7e5ef4d..ee13cfafd5c24a401acf0e392a0267bfba4e2242 100644 --- a/Plugin/Lambda2.cpp +++ b/Plugin/Lambda2.cpp @@ -1,4 +1,4 @@ -// $Id: Lambda2.cpp,v 1.15 2008-05-04 08:31:23 geuzaine Exp $ +// $Id: Lambda2.cpp,v 1.16 2008-05-12 20:24:05 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -20,7 +20,7 @@ // Please report all bugs and problems to <gmsh@geuz.org>. #include "Lambda2.h" -#include "ShapeFunctions.h" +#include "Numeric.h" StringXNumber Lambda2Options_Number[] = { {GMSH_FULLRC, "Eigenvalue", NULL, 2.}, @@ -146,7 +146,7 @@ static void eigen(List_T *inList, int inNb, } else if(nbComp == 3){ // FIXME: the following could be greatly simplified and - // generalized by using the classes in ShapeFunctions.h + // generalized by using the classes in shapeFunctions.h // val contains the velocities: compute the gradient tensor // from them diff --git a/Plugin/Makefile b/Plugin/Makefile index d52fcfea72d7ead6e32219bda11732caaf97a384..3e46e6d8a4f66733b4c9a538fbb11407f37de7e9 100644 --- a/Plugin/Makefile +++ b/Plugin/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.165 2008-05-04 08:31:23 geuzaine Exp $ +# $Id: Makefile,v 1.166 2008-05-12 20:24:05 geuzaine Exp $ # # Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle # @@ -132,8 +132,8 @@ Lambda2.o: Lambda2.cpp Lambda2.h Plugin.h ../Common/Options.h \ ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \ ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \ ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \ - ../Common/GmshMatrix.h ../Common/ShapeFunctions.h ../Numeric/Numeric.h \ - ../Numeric/NumericEmbedded.h ../Common/Message.h + ../Common/GmshMatrix.h ../Numeric/Numeric.h \ + ../Numeric/NumericEmbedded.h Eigenvectors.o: Eigenvectors.cpp Eigenvectors.h Plugin.h \ ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \ ../Post/PView.h ../Geo/SPoint3.h ../Post/PViewDataList.h \ @@ -278,27 +278,27 @@ Integrate.o: Integrate.cpp Integrate.h Plugin.h ../Common/Options.h \ ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \ ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \ ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \ - ../Common/GmshMatrix.h ../Common/ShapeFunctions.h ../Numeric/Numeric.h \ - ../Numeric/NumericEmbedded.h ../Common/Message.h ../Post/PViewOptions.h \ + ../Common/GmshMatrix.h ../Post/shapeFunctions.h ../Numeric/Numeric.h \ + ../Numeric/NumericEmbedded.h ../Post/PViewOptions.h \ ../Post/ColorTable.h Gradient.o: Gradient.cpp Gradient.h Plugin.h ../Common/Options.h \ ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \ ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \ ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \ - ../Common/GmshMatrix.h ../Common/ShapeFunctions.h ../Numeric/Numeric.h \ - ../Numeric/NumericEmbedded.h ../Common/Message.h + ../Common/GmshMatrix.h ../Post/shapeFunctions.h ../Numeric/Numeric.h \ + ../Numeric/NumericEmbedded.h Curl.o: Curl.cpp Curl.h Plugin.h ../Common/Options.h ../Post/ColorTable.h \ ../Common/Message.h ../Post/PView.h ../Geo/SPoint3.h \ ../Post/PViewDataList.h ../Post/PViewData.h ../Geo/SBoundingBox3d.h \ ../Geo/SPoint3.h ../DataStr/List.h ../Common/GmshMatrix.h \ - ../Common/ShapeFunctions.h ../Numeric/Numeric.h \ - ../Numeric/NumericEmbedded.h ../Common/Message.h + ../Post/shapeFunctions.h ../Numeric/Numeric.h \ + ../Numeric/NumericEmbedded.h Divergence.o: Divergence.cpp Divergence.h Plugin.h ../Common/Options.h \ ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \ ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \ ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \ - ../Common/GmshMatrix.h ../Common/ShapeFunctions.h ../Numeric/Numeric.h \ - ../Numeric/NumericEmbedded.h ../Common/Message.h + ../Common/GmshMatrix.h ../Post/shapeFunctions.h ../Numeric/Numeric.h \ + ../Numeric/NumericEmbedded.h Annotate.o: Annotate.cpp Annotate.h Plugin.h ../Common/Options.h \ ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \ ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \ diff --git a/Post/Makefile b/Post/Makefile index cdf1b6a084c47f00e15bc89b97b18c3d0257a888..086f1bbccf42a9c4c09d63093beb32608459a5c4 100644 --- a/Post/Makefile +++ b/Post/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.45 2008-05-04 08:31:23 geuzaine Exp $ +# $Id: Makefile,v 1.46 2008-05-12 20:24:06 geuzaine Exp $ # # Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle # @@ -139,10 +139,9 @@ OctreePost.o: OctreePost.cpp ../Common/Octree.h \ ../Geo/GPoint.h ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/SPoint2.h \ ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \ ../Geo/SBoundingBox3d.h ../Numeric/Numeric.h \ - ../Numeric/NumericEmbedded.h ../Common/Message.h \ - ../Common/ShapeFunctions.h ../Common/Message.h ../Geo/MElement.h \ - ../Common/GmshDefines.h ../Geo/MVertex.h ../Geo/SPoint3.h \ - ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h \ - ../Geo/MVertex.h ../Geo/SVector3.h + ../Numeric/NumericEmbedded.h ../Common/Message.h shapeFunctions.h \ + ../Geo/MElement.h ../Common/GmshDefines.h ../Geo/MVertex.h \ + ../Geo/SPoint3.h ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h \ + ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ColorTable.o: ColorTable.cpp ../Common/Message.h ColorTable.h \ ../Common/Context.h ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h diff --git a/Post/OctreePost.cpp b/Post/OctreePost.cpp index 8f584ebb5a6aa3d458050089e5cda68b7cd90b48..eb535de3b9272b71f33b2cf855e2ca9159b3c847 100644 --- a/Post/OctreePost.cpp +++ b/Post/OctreePost.cpp @@ -1,4 +1,4 @@ -// $Id: OctreePost.cpp,v 1.12 2008-04-22 07:37:16 geuzaine Exp $ +// $Id: OctreePost.cpp,v 1.13 2008-05-12 20:24:06 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -27,7 +27,7 @@ #include "PViewDataGModel.h" #include "Numeric.h" #include "Message.h" -#include "ShapeFunctions.h" +#include "shapeFunctions.h" #include "GModel.h" #include "MElement.h" diff --git a/Post/PViewDataGModel.cpp b/Post/PViewDataGModel.cpp index b4f154513d9e1a1c049bbfd914e986ef01918174..233a0c72927db2696f6ce94a6fdc3f5a631b9c19 100644 --- a/Post/PViewDataGModel.cpp +++ b/Post/PViewDataGModel.cpp @@ -1,4 +1,4 @@ -// $Id: PViewDataGModel.cpp,v 1.54 2008-05-04 08:31:24 geuzaine Exp $ +// $Id: PViewDataGModel.cpp,v 1.55 2008-05-12 20:24:06 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -77,6 +77,15 @@ bool PViewDataGModel::finalize() return PViewData::finalize(); } +MElement *PViewDataGModel::_getElement(int step, int ent, int ele) +{ + static int lastStep = -1, lastEnt = -1, lastEle = -1; + static MElement *curr = 0; + if(step != lastStep || ent != lastEnt || ele != lastEle) + curr = _steps[step]->getEntity(ent)->getMeshElement(ele); + return curr; +} + int PViewDataGModel::getNumTimeSteps() { return _steps.size(); @@ -225,14 +234,12 @@ int PViewDataGModel::getNumElements(int step, int ent) int PViewDataGModel::getDimension(int step, int ent, int ele) { - // no sanity checks (assumed to be guarded by skipElement) - return _steps[step]->getEntity(ent)->getMeshElement(ele)->getDim(); + return _getElement(step, ent, ele)->getDim(); } int PViewDataGModel::getNumNodes(int step, int ent, int ele) { - // no sanity checks (assumed to be guarded by skipElement) - MElement *e = _steps[step]->getEntity(ent)->getMeshElement(ele); + MElement *e = _getElement(step, ent, ele); if(_type == GaussPointData){ return _steps[step]->getGaussPoints(e->getTypeForMSH()).size() / 3; } @@ -245,8 +252,7 @@ int PViewDataGModel::getNumNodes(int step, int ent, int ele) int PViewDataGModel::getNode(int step, int ent, int ele, int nod, double &x, double &y, double &z) { - // no sanity checks (assumed to be guarded by skipElement) - MElement *e = _steps[step]->getEntity(ent)->getMeshElement(ele); + MElement *e = _getElement(step, ent, ele); if(_type == GaussPointData){ std::vector<double> &p(_steps[step]->getGaussPoints(e->getTypeForMSH())); if(p[0] == 1.e22){ @@ -280,8 +286,7 @@ int PViewDataGModel::getNode(int step, int ent, int ele, int nod, void PViewDataGModel::setNode(int step, int ent, int ele, int nod, double x, double y, double z) { - // no sanity checks (assumed to be guarded by skipElement) - MVertex *v = _steps[step]->getEntity(ent)->getMeshElement(ele)->getVertex(nod); + MVertex *v = _getElement(step, ent, ele)->getVertex(nod); v->x() = x; v->y() = y; v->z() = z; @@ -289,14 +294,12 @@ void PViewDataGModel::setNode(int step, int ent, int ele, int nod, void PViewDataGModel::tagNode(int step, int ent, int ele, int nod, int tag) { - // no sanity checks (assumed to be guarded by skipElement) - MVertex *v = _steps[step]->getEntity(ent)->getMeshElement(ele)->getVertex(nod); + MVertex *v = _getElement(step, ent, ele)->getVertex(nod); v->setIndex(tag); } int PViewDataGModel::getNumComponents(int step, int ent, int ele) { - // no sanity checks (assumed to be guarded by skipElement) return _steps[step]->getNumComponents(); } @@ -314,9 +317,8 @@ int PViewDataGModel::getNumValues(int step, int ent, int ele) void PViewDataGModel::getValue(int step, int ent, int ele, int idx, double &val) { if(_type == ElementNodeData){ - stepData<double> *sd = _steps[step]; - MElement *e = sd->getEntity(ent)->getMeshElement(ele); - val = sd->getData(e->getNum())[idx]; + MElement *e = _getElement(step, ent, ele); + val = _steps[step]->getData(e->getNum())[idx]; } else{ Msg::Error("getValue(index) should not be used on this type of view"); @@ -325,54 +327,48 @@ void PViewDataGModel::getValue(int step, int ent, int ele, int idx, double &val) void PViewDataGModel::getValue(int step, int ent, int ele, int nod, int comp, double &val) { - // no sanity checks (assumed to be guarded by skipElement) - stepData<double> *sd = _steps[step]; - MElement *e = sd->getEntity(ent)->getMeshElement(ele); + MElement *e = _getElement(step, ent, ele); switch(_type){ case NodeData: - val = sd->getData(e->getVertex(nod)->getNum())[comp]; + val = _steps[step]->getData(e->getVertex(nod)->getNum())[comp]; break; case ElementNodeData: case GaussPointData: - val = sd->getData(e->getNum())[sd->getNumComponents() * nod + comp]; + val = _steps[step]->getData(e->getNum())[_steps[step]->getNumComponents() * nod + comp]; break; case ElementData: default: - val = sd->getData(e->getNum())[comp]; + val = _steps[step]->getData(e->getNum())[comp]; break; } } void PViewDataGModel::setValue(int step, int ent, int ele, int nod, int comp, double val) { - // no sanity checks (assumed to be guarded by skipElement) - stepData<double> *sd = _steps[step]; - MElement *e = sd->getEntity(ent)->getMeshElement(ele); + MElement *e = _getElement(step, ent, ele); switch(_type){ case NodeData: - sd->getData(e->getVertex(nod)->getNum())[comp] = val; + _steps[step]->getData(e->getVertex(nod)->getNum())[comp] = val; break; case ElementNodeData: case GaussPointData: - sd->getData(e->getNum())[sd->getNumComponents() * nod + comp] = val; + _steps[step]->getData(e->getNum())[_steps[step]->getNumComponents() * nod + comp] = val; break; case ElementData: default: - sd->getData(e->getNum())[comp] = val; + _steps[step]->getData(e->getNum())[comp] = val; break; } } int PViewDataGModel::getNumEdges(int step, int ent, int ele) { - // no sanity checks (assumed to be guarded by skipElement) - return _steps[step]->getEntity(ent)->getMeshElement(ele)->getNumEdges(); + return _getElement(step, ent, ele)->getNumEdges(); } void PViewDataGModel::revertElement(int step, int ent, int ele) { - // no sanity checks (assumed to be guarded by skipElement) - if(!step) _steps[step]->getEntity(ent)->getMeshElement(ele)->revert(); + if(!step) _getElement(step, ent, ele)->revert(); } void PViewDataGModel::smooth() @@ -427,7 +423,7 @@ bool PViewDataGModel::skipElement(int step, int ent, int ele, bool checkVisibili if(step >= getNumTimeSteps()) return true; stepData<double> *sd = _steps[step]; if(!_steps[step]->getNumData()) return true; - MElement *e = sd->getEntity(ent)->getMeshElement(ele); + MElement *e = _getElement(step, ent, ele); if(checkVisibility && !e->getVisibility()) return true; if(_type == NodeData){ for(int i = 0; i < e->getNumVertices(); i++) diff --git a/Post/PViewDataGModel.h b/Post/PViewDataGModel.h index b0f8fd3ff0e66d4c0fc9339e56a85119f621e06d..9cf4cbc8cc9f34fb48712bbc044ab70c74a63d9d 100644 --- a/Post/PViewDataGModel.h +++ b/Post/PViewDataGModel.h @@ -135,6 +135,8 @@ class PViewDataGModel : public PViewData { std::set<int> _partitions; // the type of the dataset DataType _type; + // cache last element to speed up loops + MElement *_getElement(int step, int ent, int ele); public: PViewDataGModel(DataType type=NodeData); ~PViewDataGModel(); diff --git a/Common/ShapeFunctions.h b/Post/shapeFunctions.h similarity index 100% rename from Common/ShapeFunctions.h rename to Post/shapeFunctions.h