diff --git a/Post/PViewDataGModel.cpp b/Post/PViewDataGModel.cpp index fafa618bcabfaa87ec4ed79cec2b6f2f0276d3d5..c94985eaa0885b09268ea6be35cc8adebc299406 100644 --- a/Post/PViewDataGModel.cpp +++ b/Post/PViewDataGModel.cpp @@ -97,7 +97,7 @@ bool PViewDataGModel::finalize(bool computeMinMax, if(_type == NodeData || _type == ElementData) { // treat these 2 special cases separately for maximum efficiency int numComp = _steps[step]->getNumComponents(); - for(int i = 0; i < _steps[step]->getNumData(); i++) { + for(std::size_t i = 0; i < _steps[step]->getNumData(); i++) { double *d = _steps[step]->getData(i); if(d) { double val = ComputeScalarRep(numComp, d, tensorRep); @@ -737,7 +737,7 @@ void PViewDataGModel::smooth() } } } - for(int i = 0; i < _steps2.back()->getNumData(); i++) { + for(std::size_t i = 0; i < _steps2.back()->getNumData(); i++) { double *d = _steps2.back()->getData(i); if(d) { double f = nodeConnect[i]; diff --git a/Post/PViewDataGModel.h b/Post/PViewDataGModel.h index 054c669e9976126e514a4529a53f6041ead20174..624c51cb22ee192bd9f1708bae39c7eed851a3fe 100644 --- a/Post/PViewDataGModel.h +++ b/Post/PViewDataGModel.h @@ -68,9 +68,9 @@ public: _max = other._max; _numComp = other._numComp; if(other._data) { - int n = other.getNumData(); + std::size_t n = other.getNumData(); _data = new std::vector<Real *>(n, (Real *)0); - for(int i = 0; i < n; i++) { + for(std::size_t i = 0; i < n; i++) { Real *d = other.getData(i); if(d) { int m = other.getMult(i) * _numComp; @@ -106,7 +106,7 @@ public: void setMin(double min) { _min = min; } double getMax() { return _max; } void setMax(double max) { _max = max; } - int getNumData() + std::size_t getNumData() { if(!_data) return 0; return _data->size(); @@ -120,7 +120,7 @@ public: { if(index < 0) return 0; if(allocIfNeeded) { - if(index >= getNumData()) resizeData(index + 100); // optimize this + if(index >= (int)getNumData()) resizeData(index + 100); // optimize this if(!(*_data)[index]) { (*_data)[index] = new Real[_numComp * mult]; for(int i = 0; i < _numComp * mult; i++) (*_data)[index][i] = 0.; @@ -132,7 +132,7 @@ public: } } else { - if(index >= getNumData()) return 0; + if(index >= (int)getNumData()) return 0; } return (*_data)[index]; } @@ -154,7 +154,7 @@ public: double getMemoryInMb() { double b = 0.; - for(int i = 0; i < getNumData(); i++) b += getMult(i); + for(std::size_t i = 0; i < getNumData(); i++) b += getMult(i); return b * getNumComponents() * sizeof(Real) / 1024. / 1024.; } }; diff --git a/Post/PViewDataGModelIO.cpp b/Post/PViewDataGModelIO.cpp index 214dabf6cfdbb4c2c30dbcd510c7c59d8ff0b9d5..e6483d3749aca825b861b17e74524f920efd84da 100644 --- a/Post/PViewDataGModelIO.cpp +++ b/Post/PViewDataGModelIO.cpp @@ -249,7 +249,7 @@ bool PViewDataGModel::writeMSH(const std::string &fileName, double version, for(std::size_t step = 0; step < _steps.size(); step++) { int numEnt = 0, numComp = _steps[step]->getNumComponents(); - for(int i = 0; i < _steps[step]->getNumData(); i++) + for(std::size_t i = 0; i < _steps[step]->getNumData(); i++) if(_steps[step]->getData(i)) numEnt++; if(numEnt) { if(_type == NodeData) { @@ -261,7 +261,7 @@ bool PViewDataGModel::writeMSH(const std::string &fileName, double version, partitionNum); else fprintf(fp, "3\n%lu\n%d\n%d\n", step, numComp, numEnt); - for(int i = 0; i < _steps[step]->getNumData(); i++) { + for(std::size_t i = 0; i < _steps[step]->getNumData(); i++) { if(_steps[step]->getData(i)) { MVertex *v = _steps[step]->getModel()->getMeshVertexByTag(i); if(!v) { @@ -302,7 +302,7 @@ bool PViewDataGModel::writeMSH(const std::string &fileName, double version, partitionNum); else fprintf(fp, "3\n%lu\n%d\n%d\n", step, numComp, numEnt); - for(int i = 0; i < _steps[step]->getNumData(); i++) { + for(std::size_t i = 0; i < _steps[step]->getNumData(); i++) { if(_steps[step]->getData(i)) { MElement *e = model->getMeshElementByTag(i); if(!e) { @@ -926,7 +926,7 @@ bool PViewDataGModel::writeMED(const std::string &fileName) // compute profile char *profileName = (char *)"nodeProfile"; std::vector<med_int> profile, indices; - for(int i = 0; i < _steps[0]->getNumData(); i++) { + for(std::size_t i = 0; i < _steps[0]->getNumData(); i++) { if(_steps[0]->getData(i)) { MVertex *v = _steps[0]->getModel()->getMeshVertexByTag(i); if(!v) { @@ -981,7 +981,7 @@ bool PViewDataGModel::writeMED(const std::string &fileName) } for(std::size_t step = 0; step < _steps.size(); step++) { std::size_t n = 0; - for(int i = 0; i < _steps[step]->getNumData(); i++) + for(std::size_t i = 0; i < _steps[step]->getNumData(); i++) if(_steps[step]->getData(i)) n++; if(n != profile.size() || numComp != _steps[step]->getNumComponents()) { Msg::Error("Skipping incompatible step"); @@ -1049,7 +1049,7 @@ void PViewDataGModel::sendToServer(const std::string &name) for(std::size_t step = 0; step < _steps.size(); step++) { int nc = _steps[step]->getNumComponents(); int ne = 0; - for(int i = 0; i < _steps[step]->getNumData(); i++) + for(std::size_t i = 0; i < _steps[step]->getNumData(); i++) if(_steps[step]->getData(i)) ne++; if(!step){ numEnt = ne; @@ -1066,7 +1066,7 @@ void PViewDataGModel::sendToServer(const std::string &name) std::vector<double> exp; exp.push_back(numEnt); - for(int i = 0; i < _steps[0]->getNumData(); i++) { + for(std::size_t i = 0; i < _steps[0]->getNumData(); i++) { if(_steps[0]->getData(i)) { MVertex *v = _steps[0]->getModel()->getMeshVertexByTag(i); if(!v) { diff --git a/doc/texinfo/api.texi b/doc/texinfo/api.texi index b24e629c9440a9e05b43ec4c5e6fa0978bc1eff3..5f5b6075e8be7701246e5936d93f49be45f594d9 100644 --- a/doc/texinfo/api.texi +++ b/doc/texinfo/api.texi @@ -738,7 +738,7 @@ length of @code{nodeTags} that contains the x, y, z coordinates of the nodes, concatenated: [n1x, n1y, n1z, n2x, ...]. The optional @code{parametricCoord} vector contains the parametric coordinates of the nodes, if any. The length of @code{parametricCoord} can be 0 or @code{dim} times the length of -@code{nodeTags}. If the @code{nodeTag} vector is empty, new tags are +@code{nodeTags}. If the @code{nodeTags} vector is empty, new tags are automatically assigned to the nodes. @table @asis @@ -1052,16 +1052,17 @@ if @code{getBarycenters} is called with @code{numTasks} > 1. @item getElementEdgeNodes Get the nodes on the edges of all elements of type @code{elementType} classified -on the entity of tag @code{tag}. If @code{primary} is set, only the primary -(begin/end) nodes of the edges are returned. If @code{tag} < 0, get the edge -nodes for all entities. If @code{numTasks} > 1, only compute and return the part -of the data indexed by @code{task}. +on the entity of tag @code{tag}. @code{nodeTags} contains the node tags. If +@code{primary} is set, only the primary (begin/end) nodes of the edges are +returned. If @code{tag} < 0, get the edge nodes for all entities. If +@code{numTasks} > 1, only compute and return the part of the data indexed by +@code{task}. @table @asis @item Input: @code{elementType}, @code{tag}, @code{primary}, @code{task}, @code{numTasks} @item Output: -@code{nodes} +@code{nodeTags} @item Return: - @end table @@ -1069,16 +1070,17 @@ of the data indexed by @code{task}. @item getElementFaceNodes Get the nodes on the faces of type @code{faceType} (3 for triangular faces, 4 for quadrangular faces) of all elements of type @code{elementType} classified on -the entity of tag @code{tag}. If @code{primary} is set, only the primary -(corner) nodes of the faces are returned. If @code{tag} < 0, get the face nodes -for all entities. If @code{numTasks} > 1, only compute and return the part of -the data indexed by @code{task}. +the entity of tag @code{tag}. @code{nodeTags} contains the node tags. If +@code{primary} is set, only the primary (corner) nodes of the faces are +returned. If @code{tag} < 0, get the face nodes for all entities. If +@code{numTasks} > 1, only compute and return the part of the data indexed by +@code{task}. @table @asis @item Input: @code{elementType}, @code{faceType}, @code{tag}, @code{primary}, @code{task}, @code{numTasks} @item Output: -@code{nodes} +@code{nodeTags} @item Return: - @end table @@ -1282,14 +1284,16 @@ matrix, by row). Currently only available for @code{dim} == 1 and @code{dim} == @end table @item getPeriodicNodes -Get the master entity, periodic node pairs and affine transform for the entity -of dimension @code{dim} and tag @code{tag}. +Get the master entity @code{tagMaster}, the node tags @code{nodeTags} and their +corresponding master node tags @code{nodeTagsMaster}, and the affine transform +@code{affineTransform} for the entity of dimension @code{dim} and tag +@code{tag}. @table @asis @item Input: @code{dim}, @code{tag} @item Output: -@code{tagMaster}, @code{nodes}, @code{affineTransform} +@code{tagMaster}, @code{nodeTags}, @code{nodeTagsMaster}, @code{affineTransform} @item Return: - @end table @@ -2995,7 +2999,7 @@ Select elements in the user interface. @item Input: - @item Output: -@code{tags} +@code{elementTags} @item Return: integer value @end table @@ -3007,7 +3011,7 @@ Select views in the user interface. @item Input: - @item Output: -@code{tags} +@code{viewTags} @item Return: integer value @end table