message: Simplify spaceDim detection code
diff: @@ -2488,46 +2488,25 @@ void Mesh::FinalizeTopology(bool generate_bdr)
  FinalizeCheck();
  bool generate_edges = true;
  - if (spaceDim == 0) // then determine spaceDim based on min/max differences detected in any given dimension
  + if (spaceDim == 0 && vertices.Size() > 0)
  {
  - double initX = vertices[0](0);
  - double initY = vertices[0](1);
  - double initZ = vertices[0](2);
  - double minValue[3] = {initX,initY,initZ};
  - double maxValue[3] = {initX,initY,initZ};
  -
  - // we're expecting early exits
  - for(int i = 1; i < vertices.Size(); i++)
  + double min_value, max_value;
  + // determine spaceDim based on min/max differences detected each dimension
  + for (int d=0; d<3; ++d)
  {
  - minValue[0] = std::min(minValue[0],vertices[i](0));
  - maxValue[0] = std::max(maxValue[0],vertices[i](0));
  - if(minValue[0] != maxValue[0])
  - {
  - spaceDim++;
  - break;
  - }
  - } // test x values
  + min_value = max_value = vertices[0](d);
  for(int i = 1; i < vertices.Size(); i++)
  {
  - minValue[1] = std::min(minValue[1],vertices[i](1));
  - maxValue[1] = std::max(maxValue[1],vertices[i](1));
  - if(minValue[1] != maxValue[1])
  + min_value = std::min(min_value,vertices[i](d));
  + max_value = std::max(max_value,vertices[i](d));
  + if(min_value != max_value)
  {
  spaceDim++;
  break;
  }
  - } // test y values
  - for(int i = 1; i < vertices.Size(); i++)
  - {
  - minValue[2] = std::min(minValue[2],vertices[i](2));
  - maxValue[2] = std::max(maxValue[2],vertices[i](2));
  - if(minValue[2] != maxValue[2])
  - {
  - spaceDim++;
  - break;
  }
  - } // test z values
  - } // if spaceDim == 0
  + }
  + }
  if (ncmesh) { ncmesh->spaceDim = spaceDim; }
  // set the mesh type: 'meshgen', ...
  