MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / MFdiff

Function MFdiff

Tests/DivFreePatch/main.cpp:96–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94
95
96Real MFdiff(const MultiFab& lhs, const MultiFab& rhs,
97 int strt_comp, int num_comp, int nghost, const std::string name = "",
98 bool relative = false)
99{
100 MultiFab temp(lhs.boxArray(), lhs.DistributionMap(), lhs.nComp(), nghost);
101 Copy(temp, lhs, strt_comp, strt_comp, num_comp, nghost);
102 temp.minus(rhs, strt_comp, num_comp, nghost);
103 if (relative) {
104 temp.divide(rhs, strt_comp, num_comp, nghost); }
105
106 if (name != "")
107 { amrex::VisMF::Write(temp, std::string("pltfiles/" + name)); }
108
109 Real max_diff = 0;
110 for (int i=0; i<num_comp; ++i)
111 {
112 Real max_i = std::abs(temp.max(i));
113 max_diff = (max_diff > max_i) ? max_diff : max_i;
114 }
115
116 return max_diff;
117}
118
119// ================================================
120

Callers 1

AMREX_D_TERMFunction · 0.85

Calls 8

CopyFunction · 0.85
DistributionMapMethod · 0.80
WriteFunction · 0.50
boxArrayMethod · 0.45
nCompMethod · 0.45
minusMethod · 0.45
divideMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected