Skip to content

Commit

Permalink
Style
Browse files Browse the repository at this point in the history
  • Loading branch information
dylan-copeland committed Sep 12, 2023
1 parent d47c558 commit 604f53e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
32 changes: 16 additions & 16 deletions examples/prom/nonlinear_elasticity_global_rom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ CAROM::Matrix* GetFirstColumns(const int N, const CAROM::Matrix* A)
// TODO: move this to the library?
void BasisGeneratorFinalSummary(CAROM::BasisGenerator* bg,
const double energyFraction, int& cutoff,
const std::string cutoffOutputPath)
const std::string cutoffOutputPath)
{
const int rom_dim = bg->getSpatialBasis()->numColumns();
const CAROM::Vector* sing_vals = bg->getSingularValues();
Expand Down Expand Up @@ -838,16 +838,16 @@ int main(int argc, char* argv[])
CAROM::Matrix* Hsinv = new CAROM::Matrix(nsamp_H, hdim, false);
vector<int> sample_dofs(nsamp_H);

// Setup hyperreduction using DEIM, GNAT, or S-OPT
CAROM::Hyperreduction hr(samplingType);
hr.ComputeSamples(H_librom,
hdim,
sample_dofs,
num_sample_dofs_per_proc,
*Hsinv,
myid,
num_procs,
nsamp_H);
// Setup hyperreduction using DEIM, GNAT, or S-OPT
CAROM::Hyperreduction hr(samplingType);
hr.ComputeSamples(H_librom,
hdim,
sample_dofs,
num_sample_dofs_per_proc,
*Hsinv,
myid,
num_procs,
nsamp_H);

// Construct sample mesh
const int nspaces = 1;
Expand Down Expand Up @@ -877,7 +877,7 @@ int main(int argc, char* argv[])
*w = 0.0;

// Note that some of this could be done only on the ROM solver process,
// but it is tricky, since RomOperator assembles Bsp in parallel.
// but it is tricky, since RomOperator assembles Bsp in parallel.
wMFEM = new Vector(&((*w)(0)), rxdim + rvdim);

// Initial conditions
Expand All @@ -903,7 +903,7 @@ int main(int argc, char* argv[])
// 12. Set the initial conditions for v_gf, x_gf and vx, and define the
// boundary conditions on a beam-like mesh (see description above).

// Associate a FiniteElementSpace and true-dof data with the GridFunctions.
// Associate a FiniteElementSpace and true-dof data with the GridFunctions.
sp_v_gf.MakeTRef(sp_XV_space, sp_vx, sp_offset[0]);
sp_x_gf.MakeTRef(sp_XV_space, sp_vx, sp_offset[1]);

Expand Down Expand Up @@ -1091,15 +1091,15 @@ int main(int argc, char* argv[])
{
basis_generator_v->takeSample(vx_diff.GetBlock(0), t, dt);
basis_generator_v->computeNextSampleTime(vx_diff.GetBlock(0),
dvdt.GetData(), t);
dvdt.GetData(), t);
basis_generator_H->takeSample(oper.H_sp.GetData(), t, dt);
}

if (basis_generator_x->isNextSample(t))
{
basis_generator_x->takeSample(vx_diff.GetBlock(1), t, dt);
basis_generator_x->computeNextSampleTime(vx_diff.GetBlock(1),
dxdt.GetData(), t);
dxdt.GetData(), t);

if (x_base_only == true)
{
Expand Down Expand Up @@ -1181,7 +1181,7 @@ int main(int argc, char* argv[])
if (offline)
{
// Sample final solution, to prevent extrapolation in ROM between the
// last sample and the end of the simulation.
// last sample and the end of the simulation.
dvxdt = oper.dvxdt_sp.GetData();
vx_diff = BlockVector(vx);
vx_diff -= vx0;
Expand Down
12 changes: 6 additions & 6 deletions lib/hyperreduction/GNAT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void GNAT(const Matrix* f_basis,
std::vector<int> all_init_samples(total_num_init_samples);

MPI_Allgather(&num_init_samples, 1, MPI_INT, all_num_init_samples.data(),
1, MPI_INT, MPI_COMM_WORLD);
1, MPI_INT, MPI_COMM_WORLD);

for (int i = 0; i < myid; ++i)
{
Expand Down Expand Up @@ -215,14 +215,14 @@ void GNAT(const Matrix* f_basis,
double tmp = 0.0;
for (int minv_col = 0; minv_col < ns; ++minv_col) {
if (ns == i)
{
{
tmp += M.item(minv_row, minv_col)*tmp_fs.item(minv_col, i);
}
}
else
{
// Transposing M^+, which is stored as its transpose.
{
// Transposing M^+, which is stored as its transpose.
tmp += M.item(minv_col, minv_row)*tmp_fs.item(minv_col, i);
}
}
}
c[minv_row] = tmp;
}
Expand Down
20 changes: 10 additions & 10 deletions lib/hyperreduction/QDEIM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ QDEIM(const Matrix* f_basis,
}

// Reorder f_sampled_row and f_sampled_row_owner to match the order
// of f_basis_sampled_inv
// of f_basis_sampled_inv
for (int i=0; i<num_samples_req_QR; ++i)
f_sampled_row[i] = all_sampled_rows[i];

Expand Down Expand Up @@ -205,9 +205,9 @@ QDEIM(const Matrix* f_basis,
int n = numCol;
Matrix V(n, n, false);

// At this point, only the first (numCol) entries of f_sampled_row and
// rows of sampled_row_data are set by QR. Now set the remaining
// (num_samples_req - numCol) samples by GappyPOD+E.
// At this point, only the first (numCol) entries of f_sampled_row and
// rows of sampled_row_data are set by QR. Now set the remaining
// (num_samples_req - numCol) samples by GappyPOD+E.

for (int s = numCol; s < num_samples_req; ++s) // Determine sample s
{
Expand All @@ -234,7 +234,7 @@ QDEIM(const Matrix* f_basis,
delete U;

g = (sigma.getData()[n-2] * sigma.getData()[n-2]) -
(sigma.getData()[n-1] * sigma.getData()[n-1]);
(sigma.getData()[n-1] * sigma.getData()[n-1]);

// Note that V stores the right singular vectors row-wise
V.transpose();
Expand All @@ -245,7 +245,7 @@ QDEIM(const Matrix* f_basis,
// Broadcast the small n-by-n undistributed matrix V which is computed only on root.
MPI_Bcast(V.getData(), n*n, MPI_DOUBLE, 0, MPI_COMM_WORLD);

// Set Ubt = U * V = (V' * U')'
// Set Ubt = U * V = (V' * U')'
Matrix *Ubt = f_basis->mult(V); // distributed

CAROM_VERIFY(Ubt->distributed() && Ubt->numRows() == f_basis->numRows()
Expand All @@ -256,7 +256,7 @@ QDEIM(const Matrix* f_basis,
for (int i=0; i<nf; ++i)
{
r[i] = g;
// column sums of Ub.^2, which are row sums of Ubt.^2
// column sums of Ub.^2, which are row sums of Ubt.^2
for (int j=0; j<n; ++j)
r[i] += Ubt->item(i, j) * Ubt->item(i,j);

Expand Down Expand Up @@ -314,7 +314,7 @@ QDEIM(const Matrix* f_basis,
}

// Send one row of f_basis, corresponding to sample s, to the root
// process for f_basis_sampled_inv. First, scatter from root to tell
// process for f_basis_sampled_inv. First, scatter from root to tell
// the owning process the sample index.

int sample = -1;
Expand All @@ -325,7 +325,7 @@ QDEIM(const Matrix* f_basis,
{
CAROM_VERIFY(sample >= row_offset[myid]);
MPI_Send(f_basis->getData() + ((sample - row_offset[myid]) * numCol),
numCol, MPI_DOUBLE, 0, tagSendRecv, MPI_COMM_WORLD);
numCol, MPI_DOUBLE, 0, tagSendRecv, MPI_COMM_WORLD);
}

if (myid == 0)
Expand Down Expand Up @@ -417,7 +417,7 @@ QDEIM(const Matrix* f_basis,

if (!f_basis->distributed())
{
// GappyPOD+E not implemented for oversampling if not distributed
// GappyPOD+E not implemented for oversampling if not distributed
CAROM_VERIFY(numCol == num_samples_req);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/hyperreduction/S_OPT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ S_OPT(const Matrix* f_basis,
tmp += g1.item(j, k) * GG.item(j, k);
}
A->item(j) = std::max(0.0, ata +
(Vo->item(j, i - 1) * Vo->item(j, i - 1)) - tmp);
(Vo->item(j, i - 1) * Vo->item(j, i - 1)) - tmp);
}

nV.setSize(i);
Expand Down

0 comments on commit 604f53e

Please sign in to comment.