Apologies for the hyperlinks. Here without them: Hello
This function is as follows: inline bool QoISet::has_index(unsigned int i) const { return (_indices.size() <= i || _indices[i]); } Why does it accept as valid indices greater than _indices.size() (_indices.size() <= i ) ? For instance, say I have three QoI, but I want only to calculate the second QoI; therefore I create a QoISet and call add_index(1). This is going to resize _indices to two and make them all true (_indices.resize(i+1, true)). Now I am calculating 0 and 1, but also when I call QoISet::has_index(2) it is also going to accept it as valid. There must be something I am missing in the way QoISet is used. inline void QoISet::add_index(unsigned int i) { if (i >= _indices.size()) _indices.resize(i+1, true); _indices[i] = true; } Thanks Miguel On 2/22/16, 9:31 AM, "Salazar De Troya, Miguel" <salazardet...@llnl.gov> wrote: >Hello > >This function is as follows: > >inline >bool >QoISet::has_index<http://libmesh.github.io/doxygen/classlibMesh_1_1QoISet. >html#adcfff89b353ad16cb93a89d7af779fc0>(unsigned int i) const >{ > return >(_indices<http://libmesh.github.io/doxygen/classlibMesh_1_1QoISet.html#a35 >e60c59c33646526030487de732560c>.size() <= i || >_indices<http://libmesh.github.io/doxygen/classlibMesh_1_1QoISet.html#a35e >60c59c33646526030487de732560c>[i]); >} > >Why does it accept as valid indices greater than _indices.size() >(_indices<http://libmesh.github.io/doxygen/classlibMesh_1_1QoISet.html#a35 >e60c59c33646526030487de732560c>.size() <= i ) ? For instance, say I have >three QoI, but I want only to calculate the second QoI; therefore I >create a QoISet and call add_index(1). This is going to resize _indices >to two and make them all true >(_indices<http://libmesh.github.io/doxygen/classlibMesh_1_1QoISet.html#a35 >e60c59c33646526030487de732560c>.resize(i+1, true)). Now I am calculating >0 and 1, but also when I call QoISet::has_index(2) it is also going to >accept it as valid. There must be something I am missing in the way >QoISet is used. > > inline >void >QoISet::add_index<http://libmesh.github.io/doxygen/classlibMesh_1_1QoISet. >html#a934206efd80c8acc2d5bf9f5fb1b572f>(unsigned int i) >{ > if (i >= >_indices<http://libmesh.github.io/doxygen/classlibMesh_1_1QoISet.html#a35e >60c59c33646526030487de732560c>.size()) > >_indices<http://libmesh.github.io/doxygen/classlibMesh_1_1QoISet.html#a35e >60c59c33646526030487de732560c>.resize(i+1, true); > >_indices<http://libmesh.github.io/doxygen/classlibMesh_1_1QoISet.html#a35e >60c59c33646526030487de732560c>[i] = true; > } > >Thanks >Miguel > >-------------------------------------------------------------------------- >---- >Site24x7 APM Insight: Get Deep Visibility into Application Performance >APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month >Monitor end-to-end web transactions and take corrective actions now >Troubleshoot faster and improve end-user experience. Signup Now! >http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 >_______________________________________________ >Libmesh-users mailing list >Libmesh-users@lists.sourceforge.net >https://lists.sourceforge.net/lists/listinfo/libmesh-users ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 _______________________________________________ Libmesh-users mailing list Libmesh-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-users