Skip to content
Permalink
Browse files

Merge pull request #13143 from permcody/remove_beginIndex

Remove beginIndex() usage
  • Loading branch information...
friedmud committed Mar 28, 2019
2 parents 0e86a30 + 529b8f3 commit 4e969efd9eb71b018705620fc90ec9aebd64536a
Showing with 212 additions and 209 deletions.
  1. +9 −11 framework/include/actions/ActionWarehouse.h
  2. +6 −5 framework/include/userobject/NearestPointBase.h
  3. +2 −2 framework/include/utils/MooseTypes.h
  4. +52 −52 framework/src/base/Assembly.C
  5. +2 −2 framework/src/controls/TimePeriod.C
  6. +4 −4 framework/src/interfaces/TaggingInterface.C
  7. +4 −4 framework/src/kernels/NodalScalarKernel.C
  8. +4 −4 framework/src/materials/DerivativeParsedMaterialHelper.C
  9. +2 −2 framework/src/materials/ParsedMaterialHelper.C
  10. +5 −5 framework/src/mesh/PatternedMesh.C
  11. +3 −3 framework/src/mesh/StitchedMesh.C
  12. +8 −9 framework/src/meshgenerators/BreakBoundaryOnSubdomainGenerator.C
  13. +1 −1 framework/src/meshgenerators/LowerDBlockFromSidesetGenerator.C
  14. +9 −6 framework/src/meshgenerators/PatternedMeshGenerator.C
  15. +10 −7 framework/src/meshgenerators/StackGenerator.C
  16. +4 −4 framework/src/meshgenerators/StitchedMeshGenerator.C
  17. +7 −8 framework/src/meshmodifiers/BreakBoundaryOnSubdomain.C
  18. +1 −1 framework/src/meshmodifiers/LowerDBlockFromSideset.C
  19. +7 −4 framework/src/restart/DataIO.C
  20. +1 −1 framework/src/samplers/Sampler.C
  21. +2 −2 framework/src/transfers/MultiAppScalarToAuxScalarTransfer.C
  22. +8 −8 framework/src/utils/BicubicInterpolation.C
  23. +1 −1 framework/src/utils/FormattedTable.C
  24. +1 −1 framework/src/vectorpostprocessors/LeastSquaresFit.C
  25. +2 −2 framework/src/vectorpostprocessors/LeastSquaresFitHistory.C
  26. +3 −3 framework/src/vectorpostprocessors/PointSamplerBase.C
  27. +6 −6 framework/src/vectorpostprocessors/SamplerBase.C
  28. +2 −2 modules/chemical_reactions/src/actions/AddPrimarySpeciesAction.C
  29. +2 −2 modules/chemical_reactions/src/actions/AddSecondarySpeciesAction.C
  30. +1 −1 modules/chemical_reactions/src/kernels/CoupledBEKinetic.C
  31. +2 −2 modules/phase_field/src/kernels/MultiGrainRigidBodyMotion.C
  32. +1 −1 modules/phase_field/src/materials/DeformedGrainMaterial.C
  33. +2 −3 modules/phase_field/src/postprocessors/AverageGrainVolume.C
  34. +5 −5 modules/phase_field/src/postprocessors/FauxGrainTracker.C
  35. +12 −13 modules/phase_field/src/postprocessors/FeatureFloodCount.C
  36. +1 −1 modules/phase_field/src/userobjects/PolycrystalVoronoi.C
  37. +3 −4 modules/phase_field/src/vectorpostprocessors/FeatureVolumeVectorPostprocessor.C
  38. +1 −1 modules/stochastic_tools/src/samplers/MonteCarloSampler.C
  39. +2 −2 modules/stochastic_tools/src/samplers/SobolSampler.C
  40. +1 −1 modules/stochastic_tools/src/transfers/SamplerTransfer.C
  41. +2 −2 modules/stochastic_tools/src/vectorpostprocessors/SamplerData.C
  42. +2 −2 modules/stochastic_tools/src/vectorpostprocessors/StochasticResults.C
  43. +1 −1 modules/tensor_mechanics/src/auxkernels/AccumulateAux.C
  44. +2 −2 modules/tensor_mechanics/src/materials/ComputeInterfaceStress.C
  45. +1 −1 modules/xfem/src/userobjects/PointValueAtXFEMInterface.C
  46. +4 −4 test/src/actions/TestGetActionsAction.C
  47. +1 −1 test/src/vectorpostprocessors/ChannelGradientVectorPostprocessor.C
@@ -110,13 +110,12 @@ class ActionWarehouse : public ConsoleStreamInterface
template <class T>
const T & getAction(const std::string & name)
{
T * p = NULL;
for (auto i = beginIndex(_all_ptrs); i < _all_ptrs.size(); ++i)
typename std::shared_ptr<T> p;
for (auto act_ptr : _all_ptrs)
{
auto act = _all_ptrs[i].get();
if (act->name() == name)
if (act_ptr->name() == name)
{
p = dynamic_cast<T *>(act);
p = std::dynamic_pointer_cast<T>(act_ptr);
if (p)
break;
}
@@ -134,18 +133,17 @@ class ActionWarehouse : public ConsoleStreamInterface
{
// we need to create the map first to ensure that all actions in the map are unique
// and the actions are sorted by their names
std::map<std::string, const T *> actions;
for (auto i = beginIndex(_all_ptrs); i < _all_ptrs.size(); ++i)
typename std::map<std::string, const std::shared_ptr<T>> actions;
for (auto act_ptr : _all_ptrs)
{
auto act = _all_ptrs[i].get();
T * p = dynamic_cast<T *>(act);
auto p = std::dynamic_pointer_cast<T>(act_ptr);
if (p)
actions.insert(std::pair<std::string, const T *>(act->name(), p));
actions.insert(std::make_pair(act_ptr->name(), p));
}
// construct the vector from the map entries
std::vector<const T *> action_vector;
for (auto & pair : actions)
action_vector.push_back(pair.second);
action_vector.push_back(pair.second.get());
return action_vector;
}

@@ -12,6 +12,7 @@

// MOOSE includes
#include "ElementIntegralVariableUserObject.h"
#include "Enumerate.h"

// Forward Declarations
class UserObject;
@@ -103,7 +104,7 @@ NearestPointBase<UserObjectType>::NearestPointBase(const InputParameters & param
_user_objects.reserve(_points.size());

// Build each of the UserObject objects:
for (auto i = beginIndex(_points); i < _points.size(); i++)
for (MooseIndex(_points) i = 0; i < _points.size(); ++i)
{
auto sub_params = emptyInputParameters();
sub_params += parameters;
@@ -199,7 +200,7 @@ NearestPointBase<UserObjectType>::threadJoin(const UserObject & y)
{
auto & npla = static_cast<const NearestPointBase &>(y);

for (auto i = beginIndex(_user_objects); i < _user_objects.size(); i++)
for (MooseIndex(_user_objects) i = 0; i < _user_objects.size(); ++i)
_user_objects[i]->threadJoin(*npla._user_objects[i]);
}

@@ -217,16 +218,16 @@ NearestPointBase<UserObjectType>::nearestUserObject(const Point & p) const
unsigned int closest = 0;
Real closest_distance = std::numeric_limits<Real>::max();

for (auto i = beginIndex(_points); i < _points.size(); i++)
for (auto it : Moose::enumerate(_points))
{
const auto & current_point = _points[i];
const auto & current_point = it.value();

Real current_distance = (p - current_point).norm();

if (current_distance < closest_distance)
{
closest_distance = current_distance;
closest = i;
closest = it.index();
}
}

@@ -89,8 +89,8 @@ _MooseIndex(T, int)
}

template <typename T>
decltype(((T *)nullptr)->size())
_MooseIndex(T, int)
decltype(std::declval<T>().size())
_MooseIndex(T &&, int)
{
}

Oops, something went wrong.

0 comments on commit 4e969ef

Please sign in to comment.
You can’t perform that action at this time.