-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' of github.com:AMReX-Codes/amrex into devel…
…opment
- Loading branch information
Showing
2 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
AMREX_HOME ?= ../../.. | ||
|
||
DEBUG = TRUE | ||
DEBUG = FALSE | ||
|
||
DIM = 2 | ||
DIM = 3 | ||
|
||
COMP = gcc | ||
|
||
PRECISION = DOUBLE | ||
|
||
USE_MPI = TRUE | ||
USE_OMP = FALSE | ||
|
||
TEST=TRUE | ||
USE_ASSERTION=TRUE | ||
|
||
################################################### | ||
|
||
EBASE = diffmultifab | ||
|
||
# If NEEDS_f90_SRC=TRUE, look for ${EBASE}_nd.f90 | ||
NEEDS_f90_SRC = FALSE | ||
#NEEDS_f90_SRC = TRUE | ||
|
||
include $(AMREX_HOME)/Tools/GNUMake/Make.defs | ||
|
||
CEXE_sources += ${EBASE}.cpp | ||
|
||
INCLUDE_LOCATIONS += $(AMREX_HOME)/Src/Base | ||
include $(AMREX_HOME)/Src/Base/Make.package | ||
vpathdir += $(AMREX_HOME)/Src/Base | ||
|
||
INCLUDE_LOCATIONS += $(AMREX_HOME)/Src/Extern/amrdata | ||
include $(AMREX_HOME)/Src/Extern/amrdata/Make.package | ||
vpathdir += $(AMREX_HOME)/Src/Extern/amrdata | ||
|
||
INCLUDE_LOCATIONS += $(AMREX_HOME)/Tools/C_util | ||
include $(AMREX_HOME)/Tools/C_util/Make.package | ||
vpathdir += $(AMREX_HOME)/Tools/C_util | ||
|
||
ifeq ($(NEEDS_f90_SRC),TRUE) | ||
f90EXE_sources += ${EBASE}_nd.f90 | ||
endif | ||
|
||
vpath %.c : . $(vpathdir) | ||
vpath %.h : . $(vpathdir) | ||
vpath %.cpp : . $(vpathdir) | ||
vpath %.H : . $(vpathdir) | ||
vpath %.F : . $(vpathdir) | ||
vpath %.f : . $(vpathdir) | ||
vpath %.f90 : . $(vpathdir) | ||
|
||
include $(AMREX_HOME)/Tools/GNUMake/Make.rules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
|
||
#include <iostream> | ||
#include <string> | ||
|
||
#include <AMReX.H> | ||
#include <AMReX_MultiFab.H> | ||
#include <AMReX_VisMF.H> | ||
#include <AMReX_ParmParse.H> | ||
|
||
using namespace amrex; | ||
|
||
void | ||
print_usage (int, | ||
char* argv[]) | ||
{ | ||
std::cerr << "usage:\n"; | ||
std::cerr << argv[0] << " infile1=f1 infile2=f2, ngrow=ngrow" << std::endl; | ||
exit(1); | ||
} | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
amrex::Initialize(argc,argv); | ||
|
||
if (argc < 3) | ||
print_usage(argc,argv); | ||
|
||
std::string name1, name2; | ||
int ngrow = -1; | ||
{ | ||
ParmParse pp; | ||
pp.get("infile1", name1); | ||
pp.get("infile2", name2); | ||
pp.query("ngrow", ngrow); | ||
} | ||
|
||
MultiFab mf1, mf2; | ||
|
||
Print() << "Reading " << name1 << std::endl; | ||
VisMF::Read(mf1, name1); | ||
|
||
Print() << "Reading " << name2 << std::endl; | ||
VisMF::Read(mf2, name2); | ||
|
||
if (ngrow < 0) ngrow = std::min(mf1.nGrow(), mf2.nGrow()); | ||
|
||
if (mf1.boxArray() != mf2.boxArray()) { | ||
Abort("The two multifabs have different BoxArray"); | ||
} | ||
|
||
const int ncomp = mf1.nComp(); | ||
|
||
std::vector<Real> mf1_min(ncomp); | ||
std::vector<Real> mf1_max(ncomp); | ||
std::vector<Real> mf2_min(ncomp); | ||
std::vector<Real> mf2_max(ncomp); | ||
|
||
for (int icomp = 0; icomp < ncomp; ++icomp) { | ||
mf1_min[icomp] = mf1.min(icomp,ngrow); | ||
mf1_max[icomp] = mf1.max(icomp,ngrow); | ||
mf2_min[icomp] = mf2.min(icomp,ngrow); | ||
mf2_max[icomp] = mf2.max(icomp,ngrow); | ||
} | ||
|
||
DistributionMapping dmap(mf1.boxArray()); | ||
MultiFab mfdiff(mf1.boxArray(), dmap, ncomp, ngrow); | ||
|
||
MultiFab::Copy(mfdiff, mf1, 0, 0, ncomp, ngrow); | ||
mfdiff.minus(mf2, 0, ncomp, ngrow); | ||
|
||
for (int icomp = 0; icomp < ncomp; ++icomp) { | ||
Print() << "diff Min,max: " << mfdiff.min(icomp,ngrow) | ||
<< ", " << mfdiff.max(icomp,ngrow); | ||
if (ncomp > 1) { | ||
Print() << " for component " << icomp; | ||
} | ||
Print() << " 1st mf min,max: " << mf1_min[icomp] | ||
<< ", " << mf1_max[icomp] | ||
<< ", 2nd mf min,max: "; | ||
Print() << mf2_min[icomp] | ||
<< ", " << mf2_max[icomp] << "\n"; | ||
} | ||
|
||
Print() << "Writing mfdiff" << std::endl; | ||
VisMF::Write(mfdiff, "mfdiff"); | ||
|
||
amrex::Finalize(); | ||
} | ||
|