1#ifndef AMREX_COMPOSITE_SYSTEM_UTIL_H_
2#define AMREX_COMPOSITE_SYSTEM_UTIL_H_
3#include <AMReX_Config.H>
15#include <HYPRE_IJ_mv.h>
63 const auto ntrip =
Long(entry.
size());
65 for (
Long n = 0; n < ntrip; ++n) { ++offset[entry[n]+1]; }
66 for (
Long e = 0; e < nentries; ++e) { offset[e+1] += offset[e]; }
69 for (
Long n = 0; n < ntrip; ++n) { trip[
fill[entry[n]]++] = n; }
70 g.
offset.resize(nentries+1);
82 auto const* go = g.
offset.data();
83 auto const* gt = g.
trip.data();
87 for (
Long k = go[e]; k < go[e+1]; ++k) { sum += vals[gt[k]]; }
188 MPI_Comm comm,
int verbose, std::string
const& prefix)
192 auto* v = vals.
data();
194 {
return scaled(i) ? v[i]*v[i] :
Real(0.0); })
199 bool changed =
false;
204 "composite::SetupReuse: the matrix pattern changed since the kept setup");
210 {
Real d = scaled(i) ? s*v[i] - v0[i] :
Real(0.0);
return d*d; });
215 amrex::Print() << prefix <<
": the matrix changed by " << change
216 <<
" since the kept setup; redoing the setup\n";
221 if (new_setup || changed) {
229 if (scaled(i)) { v[i] *= s; }
233 current = (new_setup || changed);
269 int verbose, std::string
const& prefix,
270 std::function<
bool(
Real)>
const& converged,
271 std::function<
void()>
const& restore_x);
285 int verbose, std::string
const& prefix,
286 std::function<
bool(
Real)>
const& converged,
287 std::function<
void()>
const& restore_x);
292 std::ostringstream os;
293 os << std::scientific << std::setprecision(6) <<
x;
317 std::sort(trips.begin(), trips.end(), [] (
Triplet const& a,
Triplet const& b) {
318 return (a.row < b.row) || (a.row == b.row && a.col < b.col);
325 Long prev_row = -1, prev_col = -1;
326 for (
auto const& t : trips) {
328 if (t.row == prev_row && t.col == prev_col) {
366 if (nprocs == 1) {
return std::move(trips); }
371 for (
auto const& t : trips) {
372 auto it = std::upper_bound(rank_offset.begin(), rank_offset.end(), t.row);
373 const int p =
static_cast<int>(it - rank_offset.begin()) - 1;
375 if (
p == myproc) { local.push_back(t); }
else { sendbuf[
p].push_back(t); }
379 constexpr Long int_max = std::numeric_limits<int>::max();
380 Vector<int> sendcnt(nprocs), recvcnt(nprocs), sdispl(nprocs), rdispl(nprocs);
381 for (
int p = 0;
p < nprocs; ++
p) {
383 sendcnt[
p] =
static_cast<int>(sendbuf[
p].
size());
385 MPI_Alltoall(sendcnt.data(), 1, MPI_INT, recvcnt.data(), 1, MPI_INT, comm);
386 Long stot = 0, rtot = 0;
387 for (
int p = 0;
p < nprocs; ++
p) {
388 sdispl[
p] =
static_cast<int>(stot); stot += sendcnt[
p];
389 rdispl[
p] =
static_cast<int>(rtot); rtot += recvcnt[
p];
394 for (
auto const& b : sendbuf) { sbuf.insert(sbuf.end(), b.begin(), b.end()); }
397 local.resize(nlocal + rtot);
399 MPI_Type_contiguous(
int(
sizeof(
Triplet)), MPI_BYTE, &ttype);
400 MPI_Type_commit(&ttype);
401 MPI_Alltoallv(sbuf.data(), sendcnt.data(), sdispl.data(), ttype,
402 local.data()+nlocal, recvcnt.data(), rdispl.data(), ttype, comm);
403 MPI_Type_free(&ttype);
407 return std::move(trips);
425 const Long row_end = row_begin + nrows;
427 auto* pr = rows.
data();
428 auto* pc = cols.
data();
429 auto* pv = vals.
data();
431 auto* ppos = pos.
data();
439 auto* ps = dsend.
data();
440 auto* lr = lrows.data();
441 auto* lc = lcols.
data();
442 auto* lv = lvals.
data();
445 if (pr[i] < row_begin || pr[i] >= row_end) {
446 ps[ppos[i]] =
Triplet{.row =
Long(pr[i]), .col =
Long(pc[i]), .val = pv[i]};
448 const Long il = i - ppos[i];
458 const auto nrecv =
Long(hrecv.
size());
459 const Long nloc = n - nsend;
460 rows = std::move(lrows);
461 cols = std::move(lcols);
462 vals = std::move(lvals);
469 auto const* pt = drecv.
data();
470 auto* r = rows.
data();
471 auto* c = cols.
data();
472 auto* v = vals.
data();
475 r[nloc+i] = I(pt[i].row);
476 c[nloc+i] = I(pt[i].col);
477 v[nloc+i] = pt[i].val;
500 BL_PROFILE(
"composite::triplets_to_spmatrix");
507 const auto ntrip =
Long(rows.
size());
508 auto const* pr = rows.
data();
509 auto const* pc = cols.
data();
510 auto const* pv = vals.
data();
513 auto* pcnt = cnt.
data();
514 auto* pstart = start.
data();
525 if (r < nrows) { pcnt[r] = 0; }
else { pstart[r] = n_owned; }
528 auto* pp = perm.data();
531 const Long r = pr[i]-row_begin;
537 auto* pnu = nuniq.data();
540 const Long b = pstart[r], e = pstart[r+1];
541 for (
Long k = b+1; k < e; ++k) {
542 const Long t = pp[k];
543 const Long ct = pc[t];
545 while (m > b && (pc[pp[m-1]] > ct || (pc[pp[m-1]] == ct && pp[m-1] > t))) {
552 for (
Long k = b; k < e; ++k) {
553 if (k == b || pc[pp[k]] != pc[pp[k-1]]) { ++u; }
560 csr.row_offset.resize(nrows+1);
561 auto* pro = csr.row_offset.data();
567 csr.col_index.resize(nnz);
569 auto* pci = csr.col_index.data();
570 auto* pm = csr.mat.data();
573 if (r == nrows) { pro[r] = nnz;
return; }
575 for (
Long k = pstart[r]; k < pstart[r+1]; ++k) {
576 const Long t = pp[k];
577 if (k == pstart[r] || pc[t] != pc[pp[k-1]]) {
596 static std::map<std::string,int> counter;
621 if (nprocs == 1) {
return v; }
625 int nloc =
static_cast<int>(v.
size());
627 MPI_Gather(&nloc, 1, MPI_INT, counts.data(), 1, MPI_INT, 0, comm);
631 for (
int p = 0;
p < nprocs; ++
p) { displs[
p] =
int(ntot); ntot += counts[
p]; }
636 MPI_Gatherv(v.data(), nloc, mt, g.data(), counts.data(), displs.data(), mt, 0, comm);
651 (total <= std::min(gather_max,
Long(std::numeric_limits<int>::max())));
657 std::ofstream ofs(name);
658 if (!ofs) {
amrex::Abort(
"Cannot open dump file " + name); }
659 ofs << std::setprecision(std::numeric_limits<Real>::max_digits10);
664inline void check_dump (std::ofstream
const& ofs, std::string
const& name)
666 if (!ofs) {
amrex::Abort(
"Failed to write dump file " + name); }
676inline void write_row_map (std::string
const& file, std::string
const& title,
682 Long nglobal = info.size();
686 for (
Long r = 0; r < info.size(); ++r) {
687 for (
int c = 0; c < 4; ++c) { flat[r*4+c] = info[r][c]; }
689 auto write = [&] (std::string
const& name, std::string
const& note,
Long first_row,
693 ofs <<
"# " << title <<
"\n" << note <<
"# row level i j k scaling\n";
694 for (
Long r = 0; r < sc.size(); ++r) {
695 ofs << first_row+r+1 <<
' ' << fl[r*4] <<
' ' << fl[r*4+1] <<
' '
696 << fl[r*4+2] <<
' ' << fl[r*4+3] <<
' ' << sc[r] <<
'\n';
703 if (myproc == 0) { write(file,
"", 0, gflat, gscl); }
705 write(file +
"." + std::to_string(myproc),
706 "# part " + std::to_string(myproc) +
" of " + std::to_string(nprocs) +
707 ": rows owned by this rank\n", row_begin, flat, scaling);
764 auto write = [&] (std::string
const& name, std::string
const& note,
Vector<Long> const& rr,
768 ofs <<
"%%MatrixMarket matrix coordinate real general\n" << note;
769 ofs << nglobal <<
' ' << nglobal <<
' ' << vv.size() <<
'\n';
770 for (
Long n = 0; n < vv.size(); ++n) {
771 ofs << rr[n]+1 <<
' ' << cc[n]+1 <<
' ' << vv[n] <<
'\n';
779 if (myproc == 0) { write(file,
"", grows, gcols, gvals); }
781 write(file +
"." + std::to_string(myproc),
782 "% part " + std::to_string(myproc) +
" of " + std::to_string(nprocs) +
798 auto write = [&] (std::string
const& name, std::string
const& note,
Vector<Real> const&
x)
801 ofs <<
"%%MatrixMarket matrix array real general\n" << note;
802 ofs <<
x.size() <<
" 1\n";
803 for (
auto const& xi :
x) { ofs << xi <<
'\n'; }
808 if (myproc == 0) { write(file,
"", g); }
810 write(file +
"." + std::to_string(myproc),
811 "% part " + std::to_string(myproc) +
" of " + std::to_string(nprocs) +
812 ": rows " + std::to_string(row_begin+1) +
" to " +
813 std::to_string(row_begin+v.
size()) +
" of " + std::to_string(nglobal) +
"\n", v);
#define BL_PROFILE(a)
Definition AMReX_BLProfiler.H:593
#define AMREX_ALWAYS_ASSERT_WITH_MESSAGE(EX, MSG)
Definition AMReX_BLassert.H:49
#define AMREX_ALWAYS_ASSERT(EX)
Definition AMReX_BLassert.H:50
#define AMREX_GPU_DEVICE
Definition AMReX_GpuQualifiers.H:18
while parser_exe_t p
Definition AMReX_Parser_Exe_Body.H:33
Algebraic multigrid solver for SpMatrix / AlgVector systems.
Definition AMReX_AlgMG.H:254
void setAggressiveNumLevels(int n)
Number of levels with aggressive coarsening, starting at the finest. Next setup.
Definition AMReX_AlgMG.H:328
void setChebyshevDegree(int d)
Chebyshev polynomial degree. Next solve.
Definition AMReX_AlgMG.H:304
void setMaxCoarseSize(Long n)
Stop coarsening when a level has at most this many rows. Next setup.
Definition AMReX_AlgMG.H:326
void setPreSmooth(int nu)
Number of pre-smoothing sweeps; negative restores the smoother's default.
Definition AMReX_AlgMG.H:311
void setBottomSolver(BottomSolver bs)
Definition AMReX_AlgMG.H:366
void setPMaxElmts(int n)
Definition AMReX_AlgMG.H:343
void setPostSmooth(int nu)
Number of post-smoothing sweeps; negative restores the smoother's default.
Definition AMReX_AlgMG.H:313
void setInterpType(InterpType it)
Takes effect at the next setup.
Definition AMReX_AlgMG.H:340
void setTruncFactor(T f)
Drop interpolation weights below this fraction of the row maximum. Next setup.
Definition AMReX_AlgMG.H:351
void setMaxLevels(int n)
Definition AMReX_AlgMG.H:324
void setStrongThreshold(T theta)
Definition AMReX_AlgMG.H:321
void setSmoother(Smoother sm)
Takes effect at the next solve; the hierarchy is kept.
Definition AMReX_AlgMG.H:300
void setVerbose(int v)
Definition AMReX_AlgMG.H:290
void setKrylovSolver(KrylovSolver a)
Krylov solver with the V-cycle as preconditioner (see KrylovSolver). Default None.
Definition AMReX_AlgMG.H:353
Definition AMReX_AlgPartition.H:26
Distributed dense vector that mirrors the layout of an AlgPartition.
Definition AMReX_AlgVector.H:29
Convenience interface for configuring and invoking HYPRE IJ solvers.
Definition AMReX_HypreIJIface.H:25
size_type size() const noexcept
Definition AMReX_PODVector.H:654
iterator begin() noexcept
Definition AMReX_PODVector.H:680
void resize(size_type a_new_size, GrowthStrategy strategy=GrowthStrategy::Poisson)
Definition AMReX_PODVector.H:734
iterator end() noexcept
Definition AMReX_PODVector.H:684
void clear() noexcept
Definition AMReX_PODVector.H:652
T * data() noexcept
Definition AMReX_PODVector.H:672
Parse Parameters From Command Line and Input Files.
Definition AMReX_ParmParse.H:355
int query_enum_case_insensitive(std::string_view name, T &ref, int ival=FIRST) const
. Query enum value using given name.
Definition AMReX_ParmParse.H:1465
int query(std::string_view name, bool &ref, int ival=FIRST) const
Same as querykth() but searches for the last occurrence of name.
Definition AMReX_ParmParse.cpp:2032
This class provides the user with a few print options.
Definition AMReX_Print.H:35
Distributed CSR matrix that manages storage and GPU-friendly partitions.
Definition AMReX_SpMatrix.H:65
CSR< T, container_type > csr_type
Definition AMReX_SpMatrix.H:70
void define(AlgPartition partition, int nnz_per_row)
Allocate storage for a default-constructed matrix with a fixed number of nonzeros per row.
Definition AMReX_SpMatrix.H:917
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:29
Long size() const noexcept
Definition AMReX_Vector.H:54
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:80
amrex_long Long
Definition AMReX_INT.H:30
T Sum(N n, T const *v, T init_val=0)
Compute the sum of an array of values.
Definition AMReX_Reduce.H:1082
PODVector< T, ArenaAllocator< T > > DeviceVector
A PODVector that uses the standard memory Arena. Note that the memory might or might not be managed d...
Definition AMReX_GpuContainers.H:24
int MyProc() noexcept
Definition AMReX_ParallelDescriptor.H:128
void Sum(Gpu::DeviceVector< T > &v, MPI_Comm comm)
Definition AMReX_GpuParallelReduce.H:37
int NProcs() noexcept
Definition AMReX_ParallelDescriptor.H:255
__host__ __device__ constexpr const T & max(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:54
__host__ __device__ AMREX_FORCE_INLINE void AddNoRet(T *sum, T value) noexcept
Definition AMReX_GpuAtomic.H:322
__host__ __device__ AMREX_FORCE_INLINE T Add(T *sum, T value) noexcept
Definition AMReX_GpuAtomic.H:239
void copyAsync(HostToDevice, InIter begin, InIter end, OutIter result) noexcept
A host-to-device copy routine. Note this is just a wrapper around memcpy, so it assumes contiguous st...
Definition AMReX_GpuContainers.H:228
static constexpr DeviceToDevice deviceToDevice
Definition AMReX_GpuContainers.H:107
static constexpr DeviceToHost deviceToHost
Definition AMReX_GpuContainers.H:106
static constexpr HostToDevice hostToDevice
Definition AMReX_GpuContainers.H:105
void streamSynchronize() noexcept
Definition AMReX_GpuDevice.H:329
static constexpr struct amrex::Scan::Type::Exclusive exclusive
static constexpr RetSum retSum
Definition AMReX_Scan.H:34
T PrefixSum(N n, FIN const &fin, FOUT const &fout, TYPE, RetSum a_ret_sum=retSum)
Definition AMReX_Scan.H:815
Definition AMReX_CompositeSystemUtil.cpp:12
void write_row_map(std::string const &file, std::string const &title, Vector< std::array< Long, 4 > > const &info, Vector< Real > const &scaling, Long row_begin, MPI_Comm comm, Long gather_max)
Write the row map of a composite system: one line per row with the 1-based row, AMR level,...
Definition AMReX_CompositeSystemUtil.H:676
std::string to_sci(double x)
Scientific notation for messages (std::to_string prints 0.000000 for 1e-7).
Definition AMReX_CompositeSystemUtil.H:290
void define_gather(EntryGather &g, Vector< Long > const &entry, Long nentries)
Definition AMReX_CompositeSystemUtil.H:61
void triplets_to_spmatrix(Gpu::DeviceVector< Long > &rows, Gpu::DeviceVector< Long > &cols, Gpu::DeviceVector< Real > &vals, Long row_begin, Long nrows, Vector< Long > const &rank_offset, MPI_Comm comm, SpMatrix< Real > &mat, bool localized=false)
Build an SpMatrix of this rank's rows [row_begin, row_begin+nrows) from (row, column,...
Definition AMReX_CompositeSystemUtil.H:495
void write_vector_market(std::string const &file, Vector< Real > const &v, Long nglobal, Long row_begin, MPI_Comm comm, Long gather_max)
Write a distributed vector (this rank's rows start at the global row row_begin) as a Matrix Market de...
Definition AMReX_CompositeSystemUtil.H:793
void localize_triplets(Gpu::DeviceVector< I > &rows, Gpu::DeviceVector< I > &cols, Gpu::DeviceVector< Real > &vals, Long row_begin, Long nrows, Vector< Long > const &rank_offset, MPI_Comm comm)
Send the (row, column, value) triplets in device memory whose rows are owned by other ranks to their ...
Definition AMReX_CompositeSystemUtil.H:419
bool dump_single_file(Long total, Long gather_max, MPI_Comm comm)
Whether a dump of total values goes to one file written by rank 0 (always on one rank)....
Definition AMReX_CompositeSystemUtil.H:648
void check_dump(std::ofstream const &ofs, std::string const &name)
Abort if writing a dump file failed.
Definition AMReX_CompositeSystemUtil.H:664
bool ij_entry_slots(HYPRE_IJMatrix A, Gpu::DeviceVector< HYPRE_BigInt > const &rows, Gpu::DeviceVector< HYPRE_BigInt > const &cols, MPI_Comm comm, EntryGather &g)
The entries of the assembled hypre IJ matrix A (its diag values first, then its offd values) that the...
Definition AMReX_CompositeSystemUtil.cpp:14
void algmg_parse_options(AlgMG< Real > &mg, std::string const &prefix, AlgMGKrylovSolver krylov)
Configure an AlgMG solver from <prefix>.algmg.*: verbose, krylov (none|bicgstab|gmres|pcg; default kr...
Definition AMReX_CompositeSystemUtil.H:719
bool dump_pending(std::string const &prefix, int max)
Whether a dump with this prefix is still pending (fewer than max written).
Definition AMReX_CompositeSystemUtil.H:601
void write_matrix_market(std::string const &file, OwnedCSR const &csr, Long nglobal, MPI_Comm comm, Long gather_max)
Write a distributed matrix in Matrix Market coordinate format (1-based indices, "general"),...
Definition AMReX_CompositeSystemUtil.H:752
void ij_update_values(HYPRE_IJMatrix A, EntryGather const &g, Gpu::DeviceVector< Real > const &vals)
Definition AMReX_CompositeSystemUtil.cpp:85
ReusedSolve algmg_solve_kept(AlgMG< Real > &mg, SpMatrix< Real > &mat, bool kept, bool throw_exception, AlgVector< Real > &x, AlgVector< Real > const &b, Real bnorm, MPI_Comm comm, int verbose, std::string const &prefix, std::function< bool(Real)> const &converged, std::function< void()> const &restore_x)
Solve with mg, whose tolerances and iteration limit are set. With a kept hierarchy (kept: from an ear...
Definition AMReX_CompositeSystemUtil.cpp:165
std::ofstream open_dump(std::string const &name)
Open a dump file for writing, aborting on failure.
Definition AMReX_CompositeSystemUtil.H:655
Vector< T > gather_on_root(Vector< T > const &v, MPI_Comm comm)
Gather the chunks of a distributed array on rank 0 (ranks in order); other ranks return an empty vect...
Definition AMReX_CompositeSystemUtil.H:618
int next_dump_index(std::string const &prefix, int max)
Index of the next dump for this prefix, or -1 once max have been written.
Definition AMReX_CompositeSystemUtil.H:607
ReusedSolve ij_solve_reused(HypreIJIface &ij, bool reused, bool throw_exception, Real reltol, Real abstol, int maxiter, MPI_Comm comm, int verbose, std::string const &prefix, std::function< bool(Real)> const &converged, std::function< void()> const &restore_x)
Solve with ij. With a reused setup (reused: kept from an earlier matrix), a solve that blows up (a hy...
Definition AMReX_CompositeSystemUtil.cpp:112
Vector< Triplet > exchange_triplets(Vector< Triplet > &&trips, Vector< Long > const &rank_offset, MPI_Comm comm)
Send each triplet to the rank owning its row (rank p owns rows [rank_offset[p], rank_offset[p+1])) an...
Definition AMReX_CompositeSystemUtil.H:362
std::map< std::string, int > & dump_counters()
Dumps written so far per dump prefix, over all solver objects of the run.
Definition AMReX_CompositeSystemUtil.H:594
void gather_sum(EntryGather const &g, Real const *vals, Real *out, Long nentries)
Definition AMReX_CompositeSystemUtil.H:79
int MPI_Comm
Definition AMReX_ccse-mpi.H:51
int MPI_Datatype
Definition AMReX_ccse-mpi.H:53
__host__ __device__ void ignore_unused(const Ts &...)
No-op helper that marks variables as intentionally unused.
Definition AMReX.H:273
AlgMGInterpType
Definition AMReX_AlgMG.H:210
void ParallelFor(TypeList< CTOs... > ctos, std::array< int, sizeof...(CTOs)> const &runtime_options, T N, F &&f)
Definition AMReX_CTOParallelForImpl.H:202
AlgMGBottomSolver
Definition AMReX_AlgMG.H:200
AlgMGKrylovSolver
Definition AMReX_AlgMG.H:206
@ x
Definition AMReX_Orientation.H:14
void Abort(const std::string &msg)
Print a fatal-error message to stderr and abort execution.
Definition AMReX.cpp:239
const int[]
Definition AMReX_BLProfiler.cpp:1665
@ bnorm
Definition AMReX_MLMG.H:23
void fill(BaseFab< STRUCT > &aos_fab, F const &f)
Fill an array-of-structs BaseFab by invoking a functor per cell.
Definition AMReX_BaseFabUtility.H:58
AlgMGSmoother
Definition AMReX_AlgMG.H:219
V< Index > col_index
Definition AMReX_CSR.H:62
V< T > mat
Definition AMReX_CSR.H:61
V< Index > row_offset
Definition AMReX_CSR.H:63
Long nnz
Definition AMReX_CSR.H:64
Sorted CSR means for each row the column indices are sorted.
Definition AMReX_SpMatrix.H:49
static MPI_Datatype type()
With setup reuse, the triplets of later assemblies are summed directly into a matrix's value array,...
Definition AMReX_CompositeSystemUtil.H:51
Long numTriplets() const
Definition AMReX_CompositeSystemUtil.H:55
Gpu::DeviceVector< Long > trip
Definition AMReX_CompositeSystemUtil.H:53
Gpu::DeviceVector< Long > offset
Definition AMReX_CompositeSystemUtil.H:52
void clear()
Definition AMReX_CompositeSystemUtil.H:56
bool empty() const
Definition AMReX_CompositeSystemUtil.H:54
Rows owned by this rank in CSR form, columns sorted within each row and duplicates summed.
Definition AMReX_CompositeSystemUtil.H:302
Vector< Long > col_index
global column indices
Definition AMReX_CompositeSystemUtil.H:306
Long nnz() const
Definition AMReX_CompositeSystemUtil.H:309
void define(Long a_row_begin, Long a_nrows, Vector< Triplet > trips)
Definition AMReX_CompositeSystemUtil.H:313
Long nrows
number of rows owned by this rank
Definition AMReX_CompositeSystemUtil.H:304
Vector< Real > values
Definition AMReX_CompositeSystemUtil.H:307
Long row_begin
first global row of this rank
Definition AMReX_CompositeSystemUtil.H:303
Vector< Long > row_offset
size nrows+1
Definition AMReX_CompositeSystemUtil.H:305
void toSpMatrix(SpMatrix< Real > &mat, Vector< Long > const &rank_offset) const
Define an SpMatrix (device memory in GPU builds) with this CSR.
Definition AMReX_CompositeSystemUtil.H:342
Definition AMReX_CompositeSystemUtil.H:249
bool redone
Definition AMReX_CompositeSystemUtil.H:252
std::string error
Definition AMReX_CompositeSystemUtil.H:255
int num_iters
Definition AMReX_CompositeSystemUtil.H:250
Real final_res
Definition AMReX_CompositeSystemUtil.H:251
The state of setup reuse (HypreMLABecLap::setReuseSolverSetup, HypreMLNodeLap::setReuseSolverSetup).
Definition AMReX_CompositeSystemUtil.H:123
void setMaxChange(Real f)
The change threshold (see rescale).
Definition AMReX_CompositeSystemUtil.H:139
void setSetupMatrix(Real norm2)
Definition AMReX_CompositeSystemUtil.H:167
bool capture
Definition AMReX_CompositeSystemUtil.H:132
bool have_vals
Definition AMReX_CompositeSystemUtil.H:129
Gpu::DeviceVector< Real > setup_vals
The setup matrix's values (max_change > 0); valid on all ranks or none.
Definition AMReX_CompositeSystemUtil.H:128
Real scale
the current matrix (and rhs) is scaled by this
Definition AMReX_CompositeSystemUtil.H:125
bool rescale(Gpu::DeviceVector< Real > &vals, P const &scaled, bool new_setup, MPI_Comm comm, int verbose, std::string const &prefix)
Scale the values of vals (on the device) for which scaled(i) is true to the setup matrix (the others,...
Definition AMReX_CompositeSystemUtil.H:187
void setupDone()
Definition AMReX_CompositeSystemUtil.H:156
Real setup_norm2
squared 2-norm of the setup matrix's values
Definition AMReX_CompositeSystemUtil.H:124
Real max_change
Definition AMReX_CompositeSystemUtil.H:126
bool current
Definition AMReX_CompositeSystemUtil.H:136
(row, column, value) of a matrix entry with global indices
Definition AMReX_CompositeSystemUtil.H:42
Real val
Definition AMReX_CompositeSystemUtil.H:42
Long row
Definition AMReX_CompositeSystemUtil.H:42
Long col
Definition AMReX_CompositeSystemUtil.H:42