Skip to content
Browse files

Use consistent formatting in all for loops.

  • Loading branch information...
1 parent 0a6a97f commit 1750657fbf0d74760c03d181fa23e8ec9c2a48c9 @jwpeterson jwpeterson committed
Showing with 42 additions and 39 deletions.
  1. +12 −12 src/mesh/exodusII_io.C
  2. +8 −6 src/mesh/exodusII_io_helper.C
  3. +5 −6 src/mesh/nemesis_io.C
  4. +17 −15 src/mesh/nemesis_io_helper.C
View
24 src/mesh/exodusII_io.C
@@ -555,20 +555,20 @@ void ExodusII_IO::write_element_data (const EquationSystems & es)
// of the values in soln
std::vector<Real> complex_soln(3*num_values);
- for(unsigned i(0); i < num_vars; ++i)
+ for (unsigned i=0; i<num_vars; ++i)
{
- for(unsigned int j(0); j < num_elems; ++j)
+ for (unsigned int j=0; j<num_elems; ++j)
{
Number value = soln[i*num_vars + j];
complex_soln[3*i*num_elems + j] = value.real();
}
- for(unsigned int j(0); j < num_elems; ++j)
+ for (unsigned int j=0; j<num_elems; ++j)
{
Number value = soln[i*num_vars + j];
complex_soln[3*i*num_elems + num_elems +j] = value.imag();
}
- for(unsigned int j(0); j < num_elems; ++j)
+ for (unsigned int j=0; j<num_elems; ++j)
{
Number value = soln[i*num_vars + j];
complex_soln[3*i*num_elems + 2*num_elems + j] = std::abs(value);
@@ -640,7 +640,7 @@ void ExodusII_IO::write_nodal_data (const std::string& fname,
std::vector<Real> imag_parts(num_nodes);
std::vector<Real> magnitudes(num_nodes);
- for(unsigned int i(0); i < num_nodes; ++i)
+ for (unsigned int i=0; i<num_nodes; ++i)
{
real_parts[i] = soln[i*num_vars + c].real();
imag_parts[i] = soln[i*num_vars + c].imag();
@@ -653,7 +653,7 @@ void ExodusII_IO::write_nodal_data (const std::string& fname,
std::vector<Number> cur_soln(num_nodes);
// Copy out this variable's solution
- for(dof_id_type i=0; i<num_nodes; i++)
+ for (dof_id_type i=0; i<num_nodes; i++)
cur_soln[i] = soln[i*num_vars + c];
exio_helper->write_nodal_values(variable_name_position+1,cur_soln,_timestep);
#endif
@@ -712,20 +712,20 @@ void ExodusII_IO::write_global_data (const std::vector<Number>& soln,
// of the values in soln
std::vector<Real> complex_soln(3*num_values);
- for(unsigned i(0); i < num_vars; ++i)
+ for (unsigned i=0; i<num_vars; ++i)
{
- for(unsigned int j(0); j < num_elems; ++j)
+ for (unsigned int j=0; j<num_elems; ++j)
{
Number value = soln[i*num_vars + j];
complex_soln[3*i*num_elems + j] = value.real();
}
- for(unsigned int j(0); j < num_elems; ++j)
+ for (unsigned int j=0; j<num_elems; ++j)
{
Number value = soln[i*num_vars + j];
complex_soln[3*i*num_elems + num_elems +j] = value.imag();
}
- for(unsigned int j(0); j < num_elems; ++j)
+ for (unsigned int j=0; j<num_elems; ++j)
{
Number value = soln[i*num_vars + j];
complex_soln[3*i*num_elems + 2*num_elems + j] = std::abs(value);
@@ -839,7 +839,7 @@ void ExodusII_IO::write_nodal_data_discontinuous (const std::string& fname,
std::vector<Real> imag_parts(num_nodes);
std::vector<Real> magnitudes(num_nodes);
- for(int i(0); i < num_nodes; ++i)
+ for (int i=0; i<num_nodes; ++i)
{
real_parts[i] = soln[i*num_vars + c].real();
imag_parts[i] = soln[i*num_vars + c].imag();
@@ -852,7 +852,7 @@ void ExodusII_IO::write_nodal_data_discontinuous (const std::string& fname,
// Copy out this variable's solution
std::vector<Number> cur_soln(num_nodes);
- for(int i=0; i<num_nodes; i++)
+ for (int i=0; i<num_nodes; i++)
cur_soln[i] = soln[i*num_vars + c];
exio_helper->write_nodal_values(c+1,cur_soln,_timestep);
View
14 src/mesh/exodusII_io_helper.C
@@ -974,7 +974,9 @@ void ExodusII_IO_Helper::create(std::string filename)
// call create there.
if ((this->processor_id() == 0) || (!_run_only_on_proc0))
{
- int comp_ws(0), io_ws(0);
+ int
+ comp_ws = 0,
+ io_ws = 0;
if(_single_precision)
{
@@ -1153,7 +1155,7 @@ void ExodusII_IO_Helper::write_nodal_coordinates(const MeshBase & mesh, bool use
if(_single_precision)
{
std::vector<float> x_single(num_nodes), y_single(num_nodes), z_single(num_nodes);
- for(int i(0); i < num_nodes; ++i)
+ for (int i=0; i<num_nodes; ++i)
{
x_single[i] = static_cast<float>(x[i]);
y_single[i] = static_cast<float>(y[i]);
@@ -1647,7 +1649,7 @@ void ExodusII_IO_Helper::write_element_values(const MeshBase & mesh, const std::
if(_single_precision)
{
std::vector<float> cast_data(num_elems_this_block);
- for(unsigned int l=0; l < num_elems_this_block; ++l)
+ for (unsigned int l=0; l<num_elems_this_block; ++l)
{
cast_data[l] = static_cast<float>(data[l]);
}
@@ -1686,7 +1688,7 @@ void ExodusII_IO_Helper::write_nodal_values(int var_id, const std::vector<Real>
{
unsigned int num_values = values.size();
std::vector<float> cast_values(num_values);
- for(unsigned int i(0); i < num_values; ++i)
+ for (unsigned int i=0; i<num_values; ++i)
{
cast_values[i] = static_cast<float>(values[i]);
}
@@ -1753,7 +1755,7 @@ void ExodusII_IO_Helper::write_global_values(const std::vector<Real> & values, i
unsigned int num_values = values.size();
std::vector<float> cast_values(num_values);
- for(unsigned int i(0); i < num_values; ++i)
+ for (unsigned int i=0; i<num_values; ++i)
cast_values[i] = static_cast<float>(values[i]);
ex_err = exII::ex_put_glob_vars(ex_id, timestep, num_global_vars, &cast_values[0]);
@@ -1790,7 +1792,7 @@ std::vector<std::string> ExodusII_IO_Helper::get_complex_names(const std::vector
// This will loop over all names and create new "complex" names
// (i.e. names that start with r_, i_ or a_
- for(; names_it != names_end; ++names_it)
+ for (; names_it != names_end; ++names_it)
{
std::cout << "VARIABLE: " << *names_it << std::endl;
std::stringstream name_real, name_imag, name_abs;
View
11 src/mesh/nemesis_io.C
@@ -1092,7 +1092,7 @@ void Nemesis_IO::read (const std::string& base_filename)
nemhelper->read_nodeset(nodeset);
// Add nodes from the node_list to the BoundaryInfo object
- for(unsigned int node=0; node<nemhelper->node_list.size(); node++)
+ for (unsigned int node=0; node<nemhelper->node_list.size(); node++)
{
// Don't run past the end of our node map!
if (to_uint(nemhelper->node_list[node]-1) >= nemhelper->node_num_map.size())
@@ -1358,20 +1358,19 @@ void Nemesis_IO::write_global_data (const std::vector<Number>& soln,
// of the values in soln
std::vector<Real> complex_soln(3*num_values);
- for(unsigned i(0); i < num_vars; ++i)
+ for (unsigned i=0; i<num_vars; ++i)
{
-
- for(unsigned int j(0); j < num_elems; ++j)
+ for (unsigned int j=0; j<num_elems; ++j)
{
Number value = soln[i*num_vars + j];
complex_soln[3*i*num_elems + j] = value.real();
}
- for(unsigned int j(0); j < num_elems; ++j)
+ for (unsigned int j=0; j<num_elems; ++j)
{
Number value = soln[i*num_vars + j];
complex_soln[3*i*num_elems + num_elems +j] = value.imag();
}
- for(unsigned int j(0); j < num_elems; ++j)
+ for (unsigned int j=0; j<num_elems; ++j)
{
Number value = soln[i*num_vars + j];
complex_soln[3*i*num_elems + 2*num_elems + j] = std::abs(value);
View
32 src/mesh/nemesis_io_helper.C
@@ -710,7 +710,9 @@ void Nemesis_IO_Helper::create(std::string filename)
{
// Fall back on double precision when necessary since ExodusII
// doesn't seem to support long double
- int comp_ws(0), io_ws(0);
+ int
+ comp_ws = 0,
+ io_ws = 0;
if(_single_precision)
{
@@ -1771,9 +1773,9 @@ void Nemesis_IO_Helper::build_element_and_node_maps(const MeshBase& pmesh)
this->libmesh_node_num_to_exodus.clear();
// Set the map for nodes
- for(std::set<int>::iterator it = this->nodes_attached_to_local_elems.begin();
- it != this->nodes_attached_to_local_elems.end();
- ++it)
+ for (std::set<int>::iterator it = this->nodes_attached_to_local_elems.begin();
+ it != this->nodes_attached_to_local_elems.end();
+ ++it)
{
// I.e. given exodus_node_id,
// exodus_node_num_to_libmesh[ exodus_node_id ] returns the libmesh ID for that node.
@@ -1796,9 +1798,9 @@ void Nemesis_IO_Helper::build_element_and_node_maps(const MeshBase& pmesh)
this->libmesh_elem_num_to_exodus.clear();
// Now loop over each subdomain and get a unique numbering for the elements
- for(std::map<subdomain_id_type, std::vector<unsigned int> >::iterator it = this->subdomain_map.begin();
- it != this->subdomain_map.end();
- ++it)
+ for (std::map<subdomain_id_type, std::vector<unsigned int> >::iterator it = this->subdomain_map.begin();
+ it != this->subdomain_map.end();
+ ++it)
{
block_ids.push_back((*it).first);
@@ -2054,9 +2056,9 @@ void Nemesis_IO_Helper::write_nodesets(const MeshBase & mesh)
// See what we got
if (verbose)
{
- for(std::map<boundary_id_type, std::vector<int> >::iterator it = local_node_boundary_id_lists.begin();
- it != local_node_boundary_id_lists.end();
- ++it)
+ for (std::map<boundary_id_type, std::vector<int> >::iterator it = local_node_boundary_id_lists.begin();
+ it != local_node_boundary_id_lists.end();
+ ++it)
{
libMesh::out << "[" << this->processor_id() << "] ID: " << (*it).first << ", ";
@@ -2184,7 +2186,7 @@ void Nemesis_IO_Helper::write_sidesets(const MeshBase & mesh)
// Loop over all the elements in the family tree, store their converted IDs
// and side IDs to the map's vectors. TODO: Somehow reserve enough space for these
// push_back's...
- for(unsigned int j=0; j<family.size(); ++j)
+ for (unsigned int j=0; j<family.size(); ++j)
{
const ExodusII_IO_Helper::Conversion conv = em.assign_conversion(mesh.elem(family[j]->id())->type());
@@ -2313,7 +2315,7 @@ void Nemesis_IO_Helper::write_nodal_coordinates(const MeshBase & mesh, bool /*us
if(_single_precision)
{
std::vector<float> x_single(local_num_nodes), y_single(local_num_nodes), z_single(local_num_nodes);
- for(unsigned int i(0); i < local_num_nodes; ++i)
+ for (unsigned int i=0; i<local_num_nodes; ++i)
{
x_single[i] = static_cast<float>(x[i]);
y_single[i] = static_cast<float>(y[i]);
@@ -2428,7 +2430,7 @@ void Nemesis_IO_Helper::write_nodal_solution
std::vector<Real> imag_parts(num_nodes);
std::vector<Real> magnitudes(num_nodes);
- for(int i(0); i < num_nodes; ++i)
+ for (int i=0; i<num_nodes; ++i)
{
Number value = values[this->exodus_node_num_to_libmesh[i]*num_vars + c];
real_parts[i] = value.real();
@@ -2441,8 +2443,8 @@ void Nemesis_IO_Helper::write_nodal_solution
#else
std::vector<Number> cur_soln(num_nodes);
- //Copy out this variable's solution
- for(int i=0; i<num_nodes; i++)
+ // Copy out this variable's solution
+ for (int i=0; i<num_nodes; i++)
cur_soln[i] = values[this->exodus_node_num_to_libmesh[i]*num_vars + c];
write_nodal_values(c+1,cur_soln,timestep);

0 comments on commit 1750657

Please sign in to comment.
Something went wrong with that request. Please try again.