Skip to content

Commit

Permalink
changes clang-format to AllowShortBlocksOnASignleLine=false
Browse files Browse the repository at this point in the history
  • Loading branch information
ecoon committed Apr 23, 2024
1 parent 37a7b6e commit ae4301e
Show file tree
Hide file tree
Showing 102 changed files with 725 additions and 254 deletions.
Expand Up @@ -86,8 +86,12 @@ IntegratorColumnSum::scan(AmanziMesh::Entity_ID col,
AmanziGeometry::Point& p)
{
double contrib = (*integrand_)[0][c];
if (volume_average_ || volume_factor_) { contrib *= (*cv_)[0][c]; }
if (divide_by_density_) { contrib /= (*dens_)[0][c]; }
if (volume_average_ || volume_factor_) {
contrib *= (*cv_)[0][c];
}
if (divide_by_density_) {
contrib /= (*dens_)[0][c];
}
p[0] += contrib;

if (volume_average_) p[1] += (*cv_)[0][c];
Expand Down
16 changes: 12 additions & 4 deletions src/constitutive_relations/eos/eos_evaluator.cc
Expand Up @@ -186,7 +186,9 @@ EOSEvaluator::Evaluate_(const State& S, const std::vector<CompositeVector*>& res
auto& dens_v = *(molar_dens->ViewComponent(*comp, false));
int count = dens_v.MyLength();
for (int id = 0; id != count; ++id) {
for (int k = 0; k < num_dep; k++) { eos_params[k] = (*dep_vec[k])[0][id]; }
for (int k = 0; k < num_dep; k++) {
eos_params[k] = (*dep_vec[k])[0][id];
}
dens_v[0][id] = eos_->MolarDensity(eos_params);
AMANZI_ASSERT(dens_v[0][id] > 0);
}
Expand Down Expand Up @@ -280,17 +282,23 @@ EOSEvaluator::EvaluatePartialDerivative_(const State& S,

if (wrt == conc_key_) {
for (int id = 0; id != count; ++id) {
for (int k = 0; k < num_dep; k++) { eos_params[k] = (*dep_vec[k])[0][id]; }
for (int k = 0; k < num_dep; k++) {
eos_params[k] = (*dep_vec[k])[0][id];
}
dens_v[0][id] = eos_->DMolarDensityDC(eos_params);
}
} else if (wrt == pres_key_) {
for (int id = 0; id != count; ++id) {
for (int k = 0; k < num_dep; k++) { eos_params[k] = (*dep_vec[k])[0][id]; }
for (int k = 0; k < num_dep; k++) {
eos_params[k] = (*dep_vec[k])[0][id];
}
dens_v[0][id] = eos_->DMolarDensityDp(eos_params);
}
} else if (wrt == temp_key_) {
for (int id = 0; id != count; ++id) {
for (int k = 0; k < num_dep; k++) { eos_params[k] = (*dep_vec[k])[0][id]; }
for (int k = 0; k < num_dep; k++) {
eos_params[k] = (*dep_vec[k])[0][id];
}
dens_v[0][id] = eos_->DMolarDensityDT(eos_params);
}
} else {
Expand Down
4 changes: 3 additions & 1 deletion src/constitutive_relations/eos/viscosity_evaluator.cc
Expand Up @@ -82,7 +82,9 @@ ViscosityEvaluator::EvaluatePartialDerivative_(const State& S,
Epetra_MultiVector& result_v = *(result[0]->ViewComponent(*comp, false));

int count = result[0]->size(*comp);
for (int id = 0; id != count; ++id) { result_v[0][id] = visc_->DViscosityDT(temp_v[0][id]); }
for (int id = 0; id != count; ++id) {
result_v[0][id] = visc_->DViscosityDT(temp_v[0][id]);
}
}
}

Expand Down
Expand Up @@ -85,7 +85,9 @@ AdditiveEvaluator::EvaluatePartialDerivative_(const State& S,
auto& res = *result[0]->ViewComponent(name, false);
const auto& value_v = *value.ViewComponent(name, false);
for (int i = 0; i != res.MyLength(); ++i) {
if (value_v[0][i] == 0.0) { res[0][i] = 0.; }
if (value_v[0][i] == 0.0) {
res[0][i] = 0.;
}
}
}
}
Expand Down
Expand Up @@ -71,7 +71,9 @@ MultiplicativeEvaluator::Evaluate_(const State& S, const std::vector<CompositeVe

if (positive_) {
for (int c = 0; c != res_c.MyLength(); ++c) {
for (int i = 0; i != res_c.NumVectors(); ++i) { res_c[i][c] = std::max(res_c[i][c], 0.); }
for (int i = 0; i != res_c.NumVectors(); ++i) {
res_c[i][c] = std::max(res_c[i][c], 0.);
}
}
}
}
Expand Down Expand Up @@ -104,7 +106,9 @@ MultiplicativeEvaluator::EvaluatePartialDerivative_(const State& S,
.ViewComponent(lcv_name, false);
for (int c = 0; c != res_c.MyLength(); ++c) {
for (int i = 0; i != res_c.NumVectors(); ++i) {
if (value_c[i][c] == 0) { res_c[i][c] = 0.; }
if (value_c[i][c] == 0) {
res_c[i][c] = 0.;
}
}
}
}
Expand Down
Expand Up @@ -72,7 +72,9 @@ ReciprocalEvaluator::Evaluate_(const State& S, const std::vector<CompositeVector
if (positive_) {
for (const auto& comp : *result[0]) {
Epetra_MultiVector& res_c = *result[0]->ViewComponent(comp, false);
for (int c = 0; c != res_c.MyLength(); ++c) { res_c[0][c] = std::max(res_c[0][c], 0.); }
for (int c = 0; c != res_c.MyLength(); ++c) {
res_c[0][c] = std::max(res_c[0][c], 0.);
}
}
}
}
Expand Down
Expand Up @@ -57,7 +57,9 @@ TimeMaxEvaluator::Evaluate_(const State& S, const std::vector<CompositeVector*>&
.ViewComponent("cell", false);

if (operator_ == "max") {
for (int c = 0; c != res.MyLength(); ++c) { res[0][c] = std::max(res[0][c], dep[0][c]); }
for (int c = 0; c != res.MyLength(); ++c) {
res[0][c] = std::max(res[0][c], dep[0][c]);
}
}
}

Expand Down
Expand Up @@ -105,7 +105,9 @@ void
OverlandSourceFromSubsurfaceFluxEvaluator::Evaluate_(const State& S,
const std::vector<CompositeVector*>& result)
{
if (face_and_dirs_ == Teuchos::null) { IdentifyFaceAndDirection_(S); }
if (face_and_dirs_ == Teuchos::null) {
IdentifyFaceAndDirection_(S);
}
auto tag = my_keys_.front().second;

Teuchos::RCP<const AmanziMesh::Mesh> subsurface = S.GetMesh(domain_sub_);
Expand Down
8 changes: 6 additions & 2 deletions src/executables/ats_mesh_factory.cc
Expand Up @@ -150,7 +150,9 @@ createMeshLogical(const std::string& mesh_name,
mesh = factory.createLogical(mesh_logical_plist);
}

if (mesh != Teuchos::null) { checkVerifyMesh(*mesh_plist, mesh); }
if (mesh != Teuchos::null) {
checkVerifyMesh(*mesh_plist, mesh);
}

bool deformable = mesh_plist->get<bool>("deformable mesh", false);
S.RegisterMesh(mesh_name, mesh, deformable);
Expand Down Expand Up @@ -855,7 +857,9 @@ createMeshes(const Teuchos::RCP<Teuchos::ParameterList>& global_list,
void
setDefaultParameters(Teuchos::ParameterList& plist, const Amanzi::VerboseObject& vo)
{
if (!plist.isParameter("partitioner")) { plist.set<std::string>("partitioner", "zoltan_rcb"); }
if (!plist.isParameter("partitioner")) {
plist.set<std::string>("partitioner", "zoltan_rcb");
}
if (!plist.isSublist("verbose object")) {
plist.sublist("verbose object").set<std::string>("verbosity level", vo.getVerbLevelString());
}
Expand Down
20 changes: 15 additions & 5 deletions src/executables/coordinator.cc
Expand Up @@ -411,7 +411,9 @@ Coordinator::report_memory()
double mem = rss_usage();

double percell(mem);
if (local_ncells > 0) { percell = mem / local_ncells; }
if (local_ncells > 0) {
percell = mem / local_ncells;
}

double max_percell(0.0);
double min_percell(0.0);
Expand Down Expand Up @@ -521,7 +523,9 @@ Coordinator::get_dt(bool after_fail)
}

// cap the max step size
if (dt > max_dt_) { dt = max_dt_; }
if (dt > max_dt_) {
dt = max_dt_;
}

// ask the step manager if this step is ok
dt = tsm_->TimeStep(S_->get_time(Amanzi::Tags::NEXT), dt, after_fail);
Expand Down Expand Up @@ -602,13 +606,19 @@ Coordinator::visualize(bool force)
double time = S_->get_time();

if (!dump) {
for (const auto& vis : visualization_) { dump |= vis->DumpRequested(cycle, time); }
for (const auto& vis : visualization_) {
dump |= vis->DumpRequested(cycle, time);
}
}

if (dump) { pk_->CalculateDiagnostics(Amanzi::Tags::NEXT); }
if (dump) {
pk_->CalculateDiagnostics(Amanzi::Tags::NEXT);
}

for (const auto& vis : visualization_) {
if (force || vis->DumpRequested(cycle, time)) { WriteVis(*vis, *S_); }
if (force || vis->DumpRequested(cycle, time)) {
WriteVis(*vis, *S_);
}
}
return dump;
}
Expand Down
15 changes: 11 additions & 4 deletions src/executables/main.cc
Expand Up @@ -97,7 +97,9 @@ main(int argc, char* argv[])
#define STR(s) #s
// check for version info request
if (version) {
if (rank == 0) { std::cout << "ATS version " << XSTR(ATS_VERSION) << std::endl; }
if (rank == 0) {
std::cout << "ATS version " << XSTR(ATS_VERSION) << std::endl;
}
Kokkos::finalize();
return 0;
}
Expand Down Expand Up @@ -188,7 +190,8 @@ main(int argc, char* argv[])

// -- parse input file
Teuchos::RCP<Teuchos::ParameterList> plist;
if (Amanzi::Keys::ends_with(input_filename, ".yaml") || Amanzi::Keys::ends_with(input_filename, ".YAML")) {
if (Amanzi::Keys::ends_with(input_filename, ".yaml") ||
Amanzi::Keys::ends_with(input_filename, ".YAML")) {
plist = Teuchos::YAMLParameterList::parseYamlFile(input_filename);
} else {
plist = Teuchos::getParametersFromXmlFile(input_filename);
Expand Down Expand Up @@ -221,10 +224,14 @@ main(int argc, char* argv[])
try {
ret = driver.run();
} catch (std::string& s) {
if (rank == 0) { std::cerr << "ERROR:" << std::endl << s << std::endl; }
if (rank == 0) {
std::cerr << "ERROR:" << std::endl << s << std::endl;
}
return 1;
} catch (int& ierr) {
if (rank == 0) { std::cerr << "ERROR: unknown error code " << ierr << std::endl; }
if (rank == 0) {
std::cerr << "ERROR: unknown error code " << ierr << std::endl;
}
return ierr;
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/executables/test/executable_mesh_factory.cc
Expand Up @@ -174,7 +174,9 @@ SUITE(ATS_MESH_FACTORY)
Epetra_MultiVector vec(S->GetMesh("domain")->getMap(AmanziMesh::Entity_kind::CELL, false), 1);
vec.PutScalar(-1);

for (const auto& subdomain : *ds) { ds->doImport(subdomain, *subdomain_vecs[subdomain], vec); }
for (const auto& subdomain : *ds) {
ds->doImport(subdomain, *subdomain_vecs[subdomain], vec);
}

double result;
vec.MinValue(&result);
Expand Down Expand Up @@ -371,7 +373,9 @@ SUITE(ATS_MESH_FACTORY)
ds->doImport(subdomain, vec_l, vec2);

// fill via column
for (const auto& c : S->GetMesh("domain")->columns.getCells(col)) { vec1[0][c] = index; }
for (const auto& c : S->GetMesh("domain")->columns.getCells(col)) {
vec1[0][c] = index;
}
col++;
}

Expand Down
12 changes: 9 additions & 3 deletions src/operators/advection/advection_donor_upwind.cc
Expand Up @@ -56,7 +56,9 @@ for (unsigned int f = 0; f != nfaces_ghosted; ++f) { // loop over master and sla
int c1 = (*upwind_cell_)[f];
if (c1 >= 0) {
double u = std::abs(flux[0][f]);
for (unsigned int i = 0; i != num_dofs_; ++i) { field_f[i][f] = u * field_c[i][c1]; }
for (unsigned int i = 0; i != num_dofs_; ++i) {
field_f[i][f] = u * field_c[i][c1];
}
}
}
} // namespace Operators
Expand All @@ -76,11 +78,15 @@ for (unsigned int f = 0; f != nfaces_ghosted; ++f) { // loop over master and sla
int c2 = (*downwind_cell_)[f];

if (c1 >= 0 && c1 < ncells_owned) {
for (int i = 0; i != num_dofs_; ++i) { field_c[i][c1] -= field_f[i][f]; }
for (int i = 0; i != num_dofs_; ++i) {
field_c[i][c1] -= field_f[i][f];
}
}

if (c2 >= 0 && c2 < ncells_owned) {
for (int i = 0; i != num_dofs_; ++i) { field_c[i][c2] += field_f[i][f]; }
for (int i = 0; i != num_dofs_; ++i) {
field_c[i][c2] += field_f[i][f];
}
}
}
}
Expand Down

0 comments on commit ae4301e

Please sign in to comment.