Skip to content

Commit

Permalink
Merge pull request #906 from pshriwise/xref-methods-const
Browse files Browse the repository at this point in the history
  • Loading branch information
gonuke authored Sep 16, 2023
2 parents 0c4ae4c + b177469 commit 7337760
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions doc/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Next version
* Develop advisory tests on merge for MOAB, double-down and Geant4 (#870, #898, #899, #904)
* Adding flags to CI to ensure compatibility with MOOSE apps (#902)
* Fixing order of attribute initialization in the metadata class (#903)
* Adding const identifier to cross-reference methods (#906)

**Fixed:**
* Patch to compile with Geant4 10.6 (#803)
Expand Down
6 changes: 3 additions & 3 deletions src/dagmc/DagMC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -870,11 +870,11 @@ ErrorCode DagMC::next_vol(EntityHandle surface, EntityHandle old_volume,

/* SECTION III: Indexing & Cross-referencing */

EntityHandle DagMC::entity_by_id(int dimension, int id) {
EntityHandle DagMC::entity_by_id(int dimension, int id) const {
return GTT->entity_by_id(dimension, id);
}

int DagMC::id_by_index(int dimension, int index) {
int DagMC::id_by_index(int dimension, int index) const {
EntityHandle h = entity_by_index(dimension, index);
if (!h) return 0;

Expand All @@ -883,7 +883,7 @@ int DagMC::id_by_index(int dimension, int index) {
return result;
}

int DagMC::get_entity_id(EntityHandle this_ent) {
int DagMC::get_entity_id(EntityHandle this_ent) const {
return GTT->global_id(this_ent);
}

Expand Down
18 changes: 9 additions & 9 deletions src/dagmc/DagMC.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,16 +263,16 @@ class DagMC {
*/

/** map from dimension & global ID to EntityHandle */
EntityHandle entity_by_id(int dimension, int id);
EntityHandle entity_by_id(int dimension, int id) const;
/** map from dimension & base-1 ordinal index to EntityHandle */
EntityHandle entity_by_index(int dimension, int index);
EntityHandle entity_by_index(int dimension, int index) const;
/** map from dimension & base-1 ordinal index to global ID */
int id_by_index(int dimension, int index);
int id_by_index(int dimension, int index) const;
/** PPHW: Missing dim & global ID ==> base-1 ordinal index */
/** map from EntityHandle to base-1 ordinal index */
int index_by_handle(EntityHandle handle);
int index_by_handle(EntityHandle handle) const;
/** map from EntityHandle to global ID */
int get_entity_id(EntityHandle this_ent);
int get_entity_id(EntityHandle this_ent) const;

/**\brief get number of geometric sets corresponding to geometry of specified
*dimension
Expand All @@ -282,7 +282,7 @@ class DagMC {
*the dimensionality of the entities in question \return integer number of
*entities of that dimension
*/
unsigned int num_entities(int dimension);
unsigned int num_entities(int dimension) const;

private:
/** get all group sets on the model */
Expand Down Expand Up @@ -564,18 +564,18 @@ class DagMC {

}; // end DagMC

inline EntityHandle DagMC::entity_by_index(int dimension, int index) {
inline EntityHandle DagMC::entity_by_index(int dimension, int index) const {
assert(2 <= dimension && 3 >= dimension &&
(unsigned)index < entHandles[dimension].size());
return entHandles[dimension][index];
}

inline int DagMC::index_by_handle(EntityHandle handle) {
inline int DagMC::index_by_handle(EntityHandle handle) const {
assert(handle - setOffset < entIndices.size());
return entIndices[handle - setOffset];
}

inline unsigned int DagMC::num_entities(int dimension) {
inline unsigned int DagMC::num_entities(int dimension) const {
assert(vertex_handle_idx <= dimension && groups_handle_idx >= dimension);
return entHandles[dimension].size() - 1;
}
Expand Down

0 comments on commit 7337760

Please sign in to comment.