Skip to content

Commit d6414ce

Browse files
committed
Vast formatting changes for consistency everywhere more or less in at least fcn capitalization
For anything that is not IO related (anything but src/options and src/utilities/unified_logger.*) all the function signatures have been converted to "PascalCase" in-order to be consistent with how MFEM does things and just standardize things. IO related files (src/options/* and src/utilities/unified_logger.*) all of the functions were set to "snake_case" as this was cleaner looking for the options work and then for the loggers it better matched what the STDLIB is doing which makes things easier to read / reason about. I honestly would prefer all functions signatures look like this but with how MFEM does things that just clashed too much everywhere else :( Now there were also some member variable name changes any member variable that ended with the postfix "_" had that postfix removed. This addition is something that Claude just loves to add... and I finally got a round to removing them. I still need to make the member variable names consistent everywhere but that will likely be a fight for another day... Note, I did try using clang-tidy to enforce this automatically but it kept getting too many things wrong or changing too much. So, I just abandonded that idea of using it as a tool to automatically do this for us. I might still look into using it for other things though as well as leveraging like clang-format.
1 parent 788471d commit d6414ce

31 files changed

+571
-571
lines changed

src/boundary_conditions/BCData.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ BCData::~BCData()
1212
// TODO destructor stub
1313
}
1414

15-
void BCData::setDirBCs(mfem::Vector& y)
15+
void BCData::SetDirBCs(mfem::Vector& y)
1616
{
1717
// When doing the velocity based methods we only
1818
// need to do the below.
@@ -22,7 +22,7 @@ void BCData::setDirBCs(mfem::Vector& y)
2222
y[2] = essVel[2] * scale[2];
2323
}
2424

25-
void BCData::setScales()
25+
void BCData::SetScales()
2626
{
2727
switch (compID) {
2828
case 7:
@@ -68,7 +68,7 @@ void BCData::setScales()
6868
}
6969
}
7070

71-
void BCData::getComponents(int id, mfem::Array<bool> &component)
71+
void BCData::GetComponents(int id, mfem::Array<bool> &component)
7272
{
7373
switch (id) {
7474
case 0:

src/boundary_conditions/BCData.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class BCData
6464
*
6565
* This is used during the assembly process to enforce velocity boundary conditions.
6666
*/
67-
void setDirBCs(mfem::Vector& y);
67+
void SetDirBCs(mfem::Vector& y);
6868

6969
/**
7070
* @brief Set scaling factors based on component ID
@@ -80,7 +80,7 @@ class BCData
8080
* - compID = 6: X,Z components (1,0,1)
8181
* - compID = 7: All components (1,1,1)
8282
*/
83-
void setScales();
83+
void SetScales();
8484

8585
/**
8686
* @brief Static utility to decode component ID into boolean flags
@@ -92,7 +92,7 @@ class BCData
9292
* velocity components are active. This is used throughout the boundary condition
9393
* system to determine which degrees of freedom should be constrained.
9494
*
95-
* The mapping follows the same pattern as setScales():
95+
* The mapping follows the same pattern as SetScales():
9696
* - id = 0: (false, false, false)
9797
* - id = 1: (true, false, false)
9898
* - id = 2: (false, true, false)
@@ -102,6 +102,6 @@ class BCData
102102
* - id = 6: (true, false, true)
103103
* - id = 7: (true, true, true)
104104
*/
105-
static void getComponents(int id, mfem::Array<bool> &component);
105+
static void GetComponents(int id, mfem::Array<bool> &component);
106106
};
107107
#endif

src/boundary_conditions/BCManager.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include <fstream>
88

9-
void BCManager::updateBCData(std::unordered_map<std::string, mfem::Array<int>> & ess_bdr,
9+
void BCManager::UpdateBCData(std::unordered_map<std::string, mfem::Array<int>> & ess_bdr,
1010
mfem::Array2D<double> & scale,
1111
mfem::Vector & vgrad,
1212
std::unordered_map<std::string, mfem::Array2D<bool>> & component)
@@ -28,19 +28,19 @@ void BCManager::updateBCData(std::unordered_map<std::string, mfem::Array<int>> &
2828
if (ess_comp[i] != 0) {
2929
const int bcID = ess_id[i] - 1;
3030
ess_bdr["total"][bcID] = 1;
31-
BCData::getComponents(std::abs(ess_comp[i]), cmp_row);
31+
BCData::GetComponents(std::abs(ess_comp[i]), cmp_row);
3232

3333
component["total"](bcID, 0) = cmp_row[0];
3434
component["total"](bcID, 1) = cmp_row[1];
3535
component["total"](bcID, 2) = cmp_row[2];
3636
}
3737
}
3838

39-
updateBCData(ess_bdr["ess_vel"], scale, component["ess_vel"]);
40-
updateBCData(ess_bdr["ess_vgrad"], vgrad, component["ess_vgrad"]);
39+
UpdateBCData(ess_bdr["ess_vel"], scale, component["ess_vel"]);
40+
UpdateBCData(ess_bdr["ess_vgrad"], vgrad, component["ess_vgrad"]);
4141
}
4242

43-
void BCManager::updateBCData(mfem::Array<int> & ess_bdr, mfem::Array2D<double> & scale, mfem::Array2D<bool> & component)
43+
void BCManager::UpdateBCData(mfem::Array<int> & ess_bdr, mfem::Array2D<double> & scale, mfem::Array2D<bool> & component)
4444
{
4545
m_bcInstances.clear();
4646
ess_bdr = 0;
@@ -80,7 +80,7 @@ void BCManager::updateBCData(mfem::Array<int> & ess_bdr, mfem::Array2D<double> &
8080
bc.compID = ess_comp[i];
8181

8282
// set the boundary condition scales
83-
bc.setScales();
83+
bc.SetScales();
8484

8585
scale(bcID - 1, 0) = bc.scale[0];
8686
scale(bcID - 1, 1) = bc.scale[1];
@@ -94,15 +94,15 @@ void BCManager::updateBCData(mfem::Array<int> & ess_bdr, mfem::Array2D<double> &
9494
if (ess_comp[i] != 0) {
9595
const int bcID = ess_id[i] - 1;
9696
ess_bdr[bcID] = 1;
97-
BCData::getComponents(ess_comp[i], cmp_row);
97+
BCData::GetComponents(ess_comp[i], cmp_row);
9898
component(bcID, 0) = cmp_row[0];
9999
component(bcID, 1) = cmp_row[1];
100100
component(bcID, 2) = cmp_row[2];
101101
}
102102
}
103103
}
104104

105-
void BCManager::updateBCData(mfem::Array<int> & ess_bdr, mfem::Vector & vgrad, mfem::Array2D<bool> & component)
105+
void BCManager::UpdateBCData(mfem::Array<int> & ess_bdr, mfem::Vector & vgrad, mfem::Array2D<bool> & component)
106106
{
107107
ess_bdr = 0;
108108
vgrad.HostReadWrite();
@@ -134,7 +134,7 @@ void BCManager::updateBCData(mfem::Array<int> & ess_bdr, mfem::Vector & vgrad, m
134134
if (ess_comp[i] != 0) {
135135
const int bcID = ess_id[i] - 1;
136136
ess_bdr[bcID] = 1;
137-
BCData::getComponents(ess_comp[i], cmp_row);
137+
BCData::GetComponents(ess_comp[i], cmp_row);
138138
component(bcID, 0) = cmp_row[0];
139139
component(bcID, 1) = cmp_row[1];
140140
component(bcID, 2) = cmp_row[2];

src/boundary_conditions/BCManager.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class BCManager
4343
* @details Implements the Meyer's singleton pattern for thread-safe initialization.
4444
* The instance is created on first call and persists for the lifetime of the program.
4545
*/
46-
static BCManager & getInstance()
46+
static BCManager & GetInstance()
4747
{
4848
static BCManager bcManager;
4949
return bcManager;
@@ -67,7 +67,7 @@ class BCManager
6767
* where the outer key is the BC type ("ess_vel", "ess_vgrad", "total") and the inner
6868
* key is the time step number.
6969
*/
70-
void init(const std::vector<int> &uStep,
70+
void Init(const std::vector<int> &uStep,
7171
const std::unordered_map<int, std::vector<double>> &ess_vel,
7272
const std::unordered_map<int, std::vector<double>> &ess_vgrad,
7373
const map_of_imap &ess_comp,
@@ -154,7 +154,7 @@ class BCManager
154154
*
155155
* This is called at the beginning of each time step where boundary conditions change.
156156
*/
157-
void updateBCData(std::unordered_map<std::string, mfem::Array<int>> & ess_bdr,
157+
void UpdateBCData(std::unordered_map<std::string, mfem::Array<int>> & ess_bdr,
158158
mfem::Array2D<double> & scale,
159159
mfem::Vector & vgrad,
160160
std::unordered_map<std::string, mfem::Array2D<bool>> & component);
@@ -169,7 +169,7 @@ class BCManager
169169
* time step by checking against the list of update steps provided during initialization.
170170
* If an update is needed, the internal step counter is also updated.
171171
*/
172-
bool getUpdateStep(int step_)
172+
bool GetUpdateStep(int step_)
173173
{
174174
if(std::find(updateStep.begin(), updateStep.end(), step_) != updateStep.end()) {
175175
step = step_;
@@ -219,7 +219,7 @@ class BCManager
219219
* Processes the velocity gradient data for the current time step and sets up
220220
* the appropriate data structures for finite element assembly.
221221
*/
222-
void updateBCData(mfem::Array<int> & ess_bdr, mfem::Vector & vgrad, mfem::Array2D<bool> & component);
222+
void UpdateBCData(mfem::Array<int> & ess_bdr, mfem::Vector & vgrad, mfem::Array2D<bool> & component);
223223

224224
/**
225225
* @brief Update velocity boundary condition data
@@ -236,7 +236,7 @@ class BCManager
236236
* 3. Creates BCData objects with appropriate velocity and component settings
237237
* 4. Sets up scaling and boundary activation arrays
238238
*/
239-
void updateBCData(mfem::Array<int> & ess_bdr, mfem::Array2D<double> & scale, mfem::Array2D<bool> & component);
239+
void UpdateBCData(mfem::Array<int> & ess_bdr, mfem::Array2D<double> & scale, mfem::Array2D<bool> & component);
240240

241241
/** @brief Thread-safe initialization flag */
242242
std::once_flag init_flag;

src/fem_operators/mechanics_operator.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ NonlinearMechOperator::NonlinearMechOperator(mfem::Array<int> &ess_bdr,
2121
mfem::Vector* rhs;
2222
rhs = nullptr;
2323

24-
const auto& options = m_sim_state->getOptions();
24+
const auto& options = m_sim_state->GetOptions();
2525
auto loc_fe_space = m_sim_state->GetMeshParFiniteElementSpace();
2626

2727
// Define the parallel nonlinear form
@@ -191,7 +191,7 @@ void NonlinearMechOperator::Setup(const mfem::Vector &k) const
191191
void NonlinearMechOperator::SetupJacobianTerms() const
192192
{
193193

194-
auto mesh = m_sim_state->getMesh();
194+
auto mesh = m_sim_state->GetMesh();
195195
auto fe_space = m_sim_state->GetMeshParFiniteElementSpace();
196196
const mfem::FiniteElement &el = *fe_space->GetFE(0);
197197
const mfem::IntegrationRule *ir = &(mfem::IntRules.Get(el.GetGeomType(), 2 * el.GetOrder() + 1));;
@@ -234,7 +234,7 @@ void NonlinearMechOperator::SetupJacobianTerms() const
234234

235235
void NonlinearMechOperator::CalculateDeformationGradient(mfem::QuadratureFunction &def_grad) const
236236
{
237-
auto mesh = m_sim_state->getMesh();
237+
auto mesh = m_sim_state->GetMesh();
238238
auto fe_space = m_sim_state->GetMeshParFiniteElementSpace();
239239
const mfem::FiniteElement &el = *fe_space->GetFE(0);
240240
const mfem::IntegrationRule *ir = &(mfem::IntRules.Get(el.GetGeomType(), 2 * el.GetOrder() + 1));;
@@ -243,8 +243,8 @@ void NonlinearMechOperator::CalculateDeformationGradient(mfem::QuadratureFunctio
243243
const int nelems = fe_space->GetNE();
244244
const int ndofs = fe_space->GetFE(0)->GetDof();
245245

246-
auto x_ref = m_sim_state->getRefCoords();
247-
auto x_cur = m_sim_state->getCurrentCoords();
246+
auto x_ref = m_sim_state->GetRefCoords();
247+
auto x_cur = m_sim_state->GetCurrentCoords();
248248
//Since we never modify our mesh nodes during this operations this is okay.
249249
mfem::GridFunction *nodes = x_ref.get(); // set a nodes grid function to global current configuration
250250
int owns_nodes = 0;
@@ -259,7 +259,7 @@ void NonlinearMechOperator::CalculateDeformationGradient(mfem::QuadratureFunctio
259259
elem_restrict_lex->Mult(px, el_x);
260260

261261
def_grad = 0.0;
262-
exaconstit::kernel::grad_calc(nqpts, nelems, ndofs, el_jac.Read(), qpts_dshape.Read(), el_x.Read(), def_grad.ReadWrite());
262+
exaconstit::kernel::GradCalc(nqpts, nelems, ndofs, el_jac.Read(), qpts_dshape.Read(), el_x.Read(), def_grad.ReadWrite());
263263

264264
//We're returning our mesh nodes to the original object they were pointing to.
265265
//So, we need to cast away the const here.
@@ -274,7 +274,7 @@ void NonlinearMechOperator::CalculateDeformationGradient(mfem::QuadratureFunctio
274274
// Update the end coords used in our model
275275
void NonlinearMechOperator::UpdateEndCoords(const mfem::Vector& vel) const
276276
{
277-
m_sim_state->getPrimalField()->operator=(vel);
277+
m_sim_state->GetPrimalField()->operator=(vel);
278278
m_sim_state->UpdateNodalEndCoords();
279279
}
280280

src/mechanics_driver.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ int main(int argc, char *argv[])
169169
ExaOptions toml_opt;
170170
toml_opt.parse_options(toml_file, myid);
171171

172-
exaconstit::UnifiedLogger& logger = exaconstit::UnifiedLogger::getInstance();
172+
exaconstit::UnifiedLogger& logger = exaconstit::UnifiedLogger::get_instance();
173173
logger.initialize(toml_opt);
174174

175175
toml_opt.print_options();
@@ -233,7 +233,7 @@ int main(int argc, char *argv[])
233233
*/
234234
auto sim_state = std::make_shared<SimulationState>(toml_opt);
235235

236-
auto pmesh = sim_state->getMesh();
236+
auto pmesh = sim_state->GetMesh();
237237

238238
CALI_MARK_END("main_driver_init");
239239
/*
@@ -263,8 +263,8 @@ int main(int argc, char *argv[])
263263
* - Prepare fields for time-stepping algorithm
264264
*/
265265

266-
auto x_diff = sim_state->getDisplacement();
267-
auto v_cur = sim_state->getVelocity();
266+
auto x_diff = sim_state->GetDisplacement();
267+
auto v_cur = sim_state->GetVelocity();
268268

269269
x_diff->operator=(0.0);
270270
v_cur->operator=(0.0);
@@ -305,13 +305,13 @@ int main(int argc, char *argv[])
305305
* - Performs material state updates and post-processing at each step
306306
*/
307307
int ti = 0;
308-
auto v_sol = sim_state->getPrimalField();
309-
while (!sim_state->isFinished()) {
308+
auto v_sol = sim_state->GetPrimalField();
309+
while (!sim_state->IsFinished()) {
310310
ti++;
311311
// Print timestep information and timing statistics
312312
if (myid == 0) {
313313
std::cout << "Simulation cycle: " << ti << std::endl;
314-
sim_state->printTimeStats();
314+
sim_state->PrintTimeStats();
315315
}
316316
/*
317317
* Current Time Step Processing:
@@ -326,7 +326,7 @@ int main(int argc, char *argv[])
326326
* - Apply corrector step (SolveInit) for smooth BC transitions
327327
* - This prevents convergence issues with sudden load changes
328328
*/
329-
if (BCManager::getInstance().getUpdateStep(ti)) {
329+
if (BCManager::GetInstance().GetUpdateStep(ti)) {
330330
if (myid == 0) {
331331
std::cout << "Changing boundary conditions this step: " << ti << std::endl;
332332
}
@@ -351,9 +351,9 @@ int main(int argc, char *argv[])
351351
* - Update material state variables with converged solution
352352
* - Perform post-processing calculations and output generation
353353
*/
354-
sim_state->finishCycle();
354+
sim_state->FinishCycle();
355355
oper.UpdateModel();
356-
post_process.Update(ti, sim_state->getTrueCycleTime());
356+
post_process.Update(ti, sim_state->GetTrueCycleTime());
357357
} // end loop over time steps
358358

359359
/**

src/mfem_expt/partial_qspace.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ class PartialQuadratureSpace : public mfem::QuadratureSpaceBase {
281281
* with -1 indicating elements not in the partial set. For optimization,
282282
* when the partial space covers all elements, this array has size 1.
283283
*/
284-
const mfem::Array<int>& getGlobal2Local() const { return global2local; }
284+
const mfem::Array<int>& GetGlobal2Local() const { return global2local; }
285285

286286
/**
287287
* @brief Get read-only access to the local-to-global mapping array.
@@ -291,7 +291,7 @@ class PartialQuadratureSpace : public mfem::QuadratureSpaceBase {
291291
* The returned array provides the mapping from local element indices
292292
* (within the partial space) to global element indices (in the full mesh).
293293
*/
294-
const mfem::Array<int>& getLocal2Global() const { return local2global; }
294+
const mfem::Array<int>& GetLocal2Global() const { return local2global; }
295295

296296
/**
297297
* @brief Get read-only access to the global offset array.
@@ -302,7 +302,7 @@ class PartialQuadratureSpace : public mfem::QuadratureSpaceBase {
302302
* for all elements in the global mesh, facilitating efficient data
303303
* transfer between partial and full quadrature spaces.
304304
*/
305-
const mfem::Array<int>& getGlobalOffset() const { return global_offsets; }
305+
const mfem::Array<int>& GetGlobalOffset() const { return global_offsets; }
306306

307307
/**
308308
* @brief Get the number of elements in the local partial space.
@@ -313,7 +313,7 @@ class PartialQuadratureSpace : public mfem::QuadratureSpaceBase {
313313
* in this PartialQuadratureSpace, which may be less than the total
314314
* number of elements in the underlying mesh.
315315
*/
316-
int getNumLocalElements() const { return local2global.Size(); }
316+
int GetNumLocalElements() const { return local2global.Size(); }
317317

318318
/**
319319
* @brief Check if this partial space covers the entire mesh.
@@ -324,7 +324,7 @@ class PartialQuadratureSpace : public mfem::QuadratureSpaceBase {
324324
* to a full quadrature space, enabling certain optimizations in data
325325
* handling and memory management.
326326
*/
327-
bool isFullSpace() const { return (global2local.Size() == 1); }
327+
bool IsFullSpace() const { return (global2local.Size() == 1); }
328328

329329
/**
330330
* @brief Get the element transformation for a local entity index.

0 commit comments

Comments
 (0)