Skip to content

Commit

Permalink
Applying clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
pshriwise committed Mar 21, 2023
1 parent 78bf6e9 commit c6da794
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 42 deletions.
35 changes: 17 additions & 18 deletions src/dagmc/DagMC.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ class DagMC {
DagMC(std::shared_ptr<Interface> mb_impl = nullptr,
double overlap_tolerance = 0., double numerical_precision = .001);
// Deprecated Constructor
[[deprecated(
"Replaced by DagMC(std::shared_ptr<Interface> mb_impl, ... "
")")]] DagMC(Interface* mb_impl, double overlap_tolerance = 0.,
double numerical_precision = .001);
[
[deprecated("Replaced by DagMC(std::shared_ptr<Interface> mb_impl, ... "
")")]] DagMC(Interface* mb_impl,
double overlap_tolerance = 0.,
double numerical_precision = .001);
// Destructor
~DagMC();

Expand Down Expand Up @@ -472,24 +473,23 @@ class DagMC {
int set_verbosity(int val) {
int verbosity_max = 0;
int verbosity_min = 1;
if (val < verbosity_min || val > verbosity_max) warning("Invalid verbosity value " + std::to_string(val) + " will be set to nearest valid value.");
if (val < verbosity_min || val > verbosity_max)
warning("Invalid verbosity value " + std::to_string(val) +
" will be set to nearest valid value.");
val = std::min(std::max(verbosity_min, val), verbosity_max);
return verbosity = val;
}

int get_verbosity(int val) {
return verbosity;
}
int get_verbosity(int val) { return verbosity; }

/** console output mechanism
* @param msg Message to be written to the console
* @param lvl Message will not be written if the verbosity level
* is higher than the class instance's current verbosity setting.
* Use of -1 ensures the message will always be written.
* @param newline Whether or not to apend a newline to the message.
*/
void message(const std::string& msg, int lvl = 1, bool newline = true) const
{
*/
void message(const std::string& msg, int lvl = 1, bool newline = true) const {
// do not write message if level is higher than
// verbosity setting
if (lvl > verbosity) return;
Expand All @@ -503,18 +503,16 @@ class DagMC {
/** write a warning message to the console
* @param msg Message to be written to the console
* @param newline Whether or not to apend a newline to the message.
*/
void warning(const std::string& msg, bool newline = true) const
{
*/
void warning(const std::string& msg, bool newline = true) const {
message("WARNING: " + msg, -1, newline);
}

/** write an error message to the console
* @param msg Message to be written to the console
* @param newline Whether or not to apend a newline to the message.
*/
void err_msg(const std::string& msg, bool newline = true) const
{
*/
void err_msg(const std::string& msg, bool newline = true) const {
message("ERROR: " + msg, -1, newline);
}

Expand All @@ -539,7 +537,8 @@ class DagMC {
std::unique_ptr<RayTracer> ray_tracer;

/** verbosity setting for DAGMC operations */
int verbosity {1};
int verbosity{1};

public:
Tag nameTag, facetingTolTag;

Expand Down
20 changes: 11 additions & 9 deletions src/dagmc/dagmcmetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include <algorithm>
#include <iostream>
#include <sstream>
#include <set>
#include <sstream>

#include "util.hpp"

Expand Down Expand Up @@ -285,10 +285,12 @@ void dagmcMetaData::parse_importance_data() {
importance_map[eh][pair.first] = imp;
} else {
std::stringstream ss;
ss << "Volume with ID " << volid << " has more than one importance " << std::endl;
ss << "Volume with ID " << volid << " has more than one importance "
<< std::endl;
ss << "Assigned for particle type " << pair.first << std::endl;
ss << "Only one importance value per volume per particle type "
"is allowed" << std::endl;
"is allowed"
<< std::endl;
message(ss.str(), -1, false);
exit(EXIT_FAILURE);
}
Expand Down Expand Up @@ -363,14 +365,13 @@ void dagmcMetaData::parse_boundary_data() {
if (boundary_assignment.size() != 1) {
std::stringstream ss;
ss << "More than one boundary conditions specified for " << surfid
<< std::endl;
ss << surfid << " has the following density assignments"
<< std::endl;
<< std::endl;
ss << surfid << " has the following density assignments" << std::endl;
for (int j = 0; j < boundary_assignment.size(); j++) {
ss << boundary_assignment[j] << std::endl;
}
ss << "Please check your boundary condition assignments " << surfid
<< std::endl;
<< std::endl;
err_msg(ss.str());
exit(EXIT_FAILURE);
}
Expand Down Expand Up @@ -623,8 +624,9 @@ std::pair<std::string, std::string> dagmcMetaData::split_string(
int str_length = property_string.length() - found_delimiter;
second = property_string.substr(found_delimiter + 1, str_length);
} else {
warning("Didn't find any delimiter.\n "
"Returning empty strings");
warning(
"Didn't find any delimiter.\n "
"Returning empty strings");
}

return {first, second};
Expand Down
27 changes: 12 additions & 15 deletions src/dagmc/dagmcmetadata.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef SRC_DAGMC_DAGMCMETADATA_HPP_
#define SRC_DAGMC_DAGMCMETADATA_HPP_
#include <iostream>
#include <sstream>
#include <set>
#include <sstream>

#include "DagMC.hpp"

Expand Down Expand Up @@ -117,24 +117,23 @@ class dagmcMetaData {
int set_verbosity(int val) {
int verbosity_max = 0;
int verbosity_min = 1;
if (val < verbosity_min || val > verbosity_max) warning("Invalid verbosity value " + std::to_string(val) + " will be set to nearest valid value.");
if (val < verbosity_min || val > verbosity_max)
warning("Invalid verbosity value " + std::to_string(val) +
" will be set to nearest valid value.");
val = std::min(std::max(verbosity_min, val), verbosity_max);
return verbosity = val;
}

int get_verbosity(int val) {
return verbosity;
}
int get_verbosity(int val) { return verbosity; }

/** console output mechanism
* @param msg Message to be written to the console
* @param lvl Message will not be written if the verbosity level
* is higher than the class instance's current verbosity setting.
* Use of -1 ensures the message will always be written.
* @param newline Whether or not to apend a newline to the message.
*/
void message(const std::string& msg, int lvl = 1, bool newline = true) const
{
*/
void message(const std::string& msg, int lvl = 1, bool newline = true) const {
// do not write message if level is higher than
// verbosity setting
if (lvl > verbosity) return;
Expand All @@ -148,25 +147,23 @@ class dagmcMetaData {
/** write a warning message to the console
* @param msg Message to be written to the console
* @param newline Whether or not to apend a newline to the message.
*/
void warning(const std::string& msg, bool newline = true) const
{
*/
void warning(const std::string& msg, bool newline = true) const {
message("WARNING: " + msg, -1, newline);
}

/** write an error message to the console
* @param msg Message to be written to the console
* @param newline Whether or not to apend a newline to the message.
*/
void err_msg(const std::string& msg, bool newline = true) const
{
*/
void err_msg(const std::string& msg, bool newline = true) const {
message("ERROR: " + msg, -1, newline);
}

// private member variables
private:
moab::DagMC* DAG; // Pointer to DAGMC instance
int verbosity {1}; // Provide additional output while setting up and parsing
int verbosity{1}; // Provide additional output while setting up and parsing
// properties
bool require_density; // Require that all volumes have a specified density
// value
Expand Down

0 comments on commit c6da794

Please sign in to comment.